Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import streamlit as st
|
|
4 |
import cv2
|
5 |
from streamlit_drawable_canvas import st_canvas
|
6 |
import torch
|
7 |
-
|
8 |
from diffusers import AutoPipelineForInpainting
|
9 |
import numpy as np
|
10 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
@@ -34,7 +34,7 @@ from streamlit_pdf_viewer import pdf_viewer
|
|
34 |
|
35 |
|
36 |
|
37 |
-
|
38 |
def consume_llm_api(prompt):
|
39 |
"""
|
40 |
Sends a prompt to the LLM API and processes the streamed response.
|
@@ -205,7 +205,7 @@ def d4_to_3d(image):
|
|
205 |
return np.array(formatted_array)
|
206 |
|
207 |
st.set_page_config(layout="wide")
|
208 |
-
|
209 |
# st.write(str(os.getcwd()))
|
210 |
screen_width = streamlit_js_eval(label="screen.width",js_expressions='screen.width')
|
211 |
screen_height = streamlit_js_eval(label="screen.height",js_expressions='screen.height')
|
@@ -543,7 +543,7 @@ with st.spinner('Wait for it...'):
|
|
543 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=100, chunk_overlap=100)
|
544 |
chunks = text_splitter.split_documents(data)
|
545 |
|
546 |
-
dictionary['text_embeddings'][str(data)]={str(chunk.page_content):model.encode(str(chunk.page_content)) for chunk in chunks}
|
547 |
|
548 |
embeddings = [dictionary['text_embeddings'][str(data)][i] for i in dictionary['text_embeddings'][str(data)]]
|
549 |
vector_store = []
|
|
|
4 |
import cv2
|
5 |
from streamlit_drawable_canvas import st_canvas
|
6 |
import torch
|
7 |
+
import numpy as np
|
8 |
from diffusers import AutoPipelineForInpainting
|
9 |
import numpy as np
|
10 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
|
34 |
|
35 |
|
36 |
|
37 |
+
|
38 |
def consume_llm_api(prompt):
|
39 |
"""
|
40 |
Sends a prompt to the LLM API and processes the streamed response.
|
|
|
205 |
return np.array(formatted_array)
|
206 |
|
207 |
st.set_page_config(layout="wide")
|
208 |
+
dictionary=st.session_state
|
209 |
# st.write(str(os.getcwd()))
|
210 |
screen_width = streamlit_js_eval(label="screen.width",js_expressions='screen.width')
|
211 |
screen_height = streamlit_js_eval(label="screen.height",js_expressions='screen.height')
|
|
|
543 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=100, chunk_overlap=100)
|
544 |
chunks = text_splitter.split_documents(data)
|
545 |
|
546 |
+
dictionary['text_embeddings'][str(data)]={str(chunk.page_content):np.array(model.encode(str(chunk.page_content))) for chunk in chunks}
|
547 |
|
548 |
embeddings = [dictionary['text_embeddings'][str(data)][i] for i in dictionary['text_embeddings'][str(data)]]
|
549 |
vector_store = []
|