Spaces:
Sleeping
Sleeping
tonyliu404
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -15,5 +15,26 @@ from langchain_core.messages import HumanMessage, SystemMessage
|
|
15 |
from PIL import Image
|
16 |
import json
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
print("HELLO WORLD")
|
19 |
st.title("Results")
|
|
|
15 |
from PIL import Image
|
16 |
import json
|
17 |
|
18 |
+
st.set_page_config(
|
19 |
+
page_title="Food Chain",
|
20 |
+
page_icon="🍴"
|
21 |
+
)
|
22 |
+
|
23 |
+
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
24 |
+
mongo_uri = os.getenv("MONGO_URI_RAG_RECIPE")
|
25 |
+
|
26 |
+
@st.cache_resource
|
27 |
+
def loadEmbedding():
|
28 |
+
embedding = SentenceTransformer("thenlper/gte-large")
|
29 |
+
return embedding
|
30 |
+
embedding = loadEmbedding()
|
31 |
+
|
32 |
+
|
33 |
+
def getEmbedding(text):
|
34 |
+
if not text.strip():
|
35 |
+
print("Text was empty")
|
36 |
+
return []
|
37 |
+
encoded = embedding.encode(text)
|
38 |
+
return encoded.tolist()
|
39 |
print("HELLO WORLD")
|
40 |
st.title("Results")
|