Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +7 -1
src/streamlit_app.py
CHANGED
|
@@ -22,6 +22,12 @@ import os
|
|
| 22 |
os.environ["HF_HOME"] = "/app/hf_cache"
|
| 23 |
os.environ["TRANSFORMERS_CACHE"] = "/app/hf_cache"
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
global chat_messages
|
| 26 |
chat_messages=[]
|
| 27 |
outputs=[]
|
|
@@ -147,7 +153,7 @@ if 'doc_flag' not in st.session_state:
|
|
| 147 |
if 'flag' not in st.session_state:
|
| 148 |
st.session_state.flag = False
|
| 149 |
if 'encoder' not in st.session_state:
|
| 150 |
-
st.session_state.encoder =
|
| 151 |
if 'file_text' not in st.session_state:
|
| 152 |
st.session_state.file_text = ""
|
| 153 |
if "chPay" not in st.session_state:
|
|
|
|
| 22 |
os.environ["HF_HOME"] = "/app/hf_cache"
|
| 23 |
os.environ["TRANSFORMERS_CACHE"] = "/app/hf_cache"
|
| 24 |
|
| 25 |
+
encoder = SentenceTransformer(
|
| 26 |
+
"sentence-transformers/all-MiniLM-L6-v2",
|
| 27 |
+
cache_folder="/app/hf_cache"
|
| 28 |
+
).to(device)
|
| 29 |
+
|
| 30 |
+
|
| 31 |
global chat_messages
|
| 32 |
chat_messages=[]
|
| 33 |
outputs=[]
|
|
|
|
| 153 |
if 'flag' not in st.session_state:
|
| 154 |
st.session_state.flag = False
|
| 155 |
if 'encoder' not in st.session_state:
|
| 156 |
+
st.session_state.encoder = encoder
|
| 157 |
if 'file_text' not in st.session_state:
|
| 158 |
st.session_state.file_text = ""
|
| 159 |
if "chPay" not in st.session_state:
|