Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +7 -3
src/streamlit_app.py
CHANGED
@@ -16,8 +16,12 @@ import requests
|
|
16 |
from cloudhands import CloudHandsPayment
|
17 |
from database_center import db_transaction
|
18 |
device='cuda' if torch.cuda.is_available() else 'cpu'
|
19 |
-
os
|
20 |
-
|
|
|
|
|
|
|
|
|
21 |
global chat_messages
|
22 |
chat_messages=[]
|
23 |
outputs=[]
|
@@ -143,7 +147,7 @@ if 'doc_flag' not in st.session_state:
|
|
143 |
if 'flag' not in st.session_state:
|
144 |
st.session_state.flag = False
|
145 |
if 'encoder' not in st.session_state:
|
146 |
-
st.session_state.encoder = SentenceTransformer("all-MiniLM-L6-v2").to(device)
|
147 |
if 'file_text' not in st.session_state:
|
148 |
st.session_state.file_text = ""
|
149 |
if "chPay" not in st.session_state:
|
|
|
16 |
from cloudhands import CloudHandsPayment
|
17 |
from database_center import db_transaction
|
18 |
device='cuda' if torch.cuda.is_available() else 'cpu'
|
19 |
+
import os
|
20 |
+
|
21 |
+
# Explicitly override cache paths (matches Dockerfile ENV)
|
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 |
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 = SentenceTransformer("all-MiniLM-L6-v2",cache_folder="/app/hf_cache").to(device)
|
151 |
if 'file_text' not in st.session_state:
|
152 |
st.session_state.file_text = ""
|
153 |
if "chPay" not in st.session_state:
|