Spaces:
Sleeping
Sleeping
Fix timeout issues for HF Spaces deployment
Browse files- app/assistant_v2.py +2 -1
- app/vector_store.py +4 -0
app/assistant_v2.py
CHANGED
|
@@ -59,7 +59,8 @@ def initialize_models(use_lora=False):
|
|
| 59 |
@st.cache_resource
|
| 60 |
def initialize_vector_store():
|
| 61 |
"""Initialize vector store (FAISS by default, Qdrant Cloud optional)."""
|
| 62 |
-
|
|
|
|
| 63 |
if Config.USE_QDRANT:
|
| 64 |
store_type = "Qdrant Cloud"
|
| 65 |
else:
|
|
|
|
| 59 |
@st.cache_resource
|
| 60 |
def initialize_vector_store():
|
| 61 |
"""Initialize vector store (FAISS by default, Qdrant Cloud optional)."""
|
| 62 |
+
with st.spinner("Loading embedding model..."):
|
| 63 |
+
vector_store = VectorStore()
|
| 64 |
if Config.USE_QDRANT:
|
| 65 |
store_type = "Qdrant Cloud"
|
| 66 |
else:
|
app/vector_store.py
CHANGED
|
@@ -14,6 +14,10 @@ class VectorStore:
|
|
| 14 |
"""Vector storage with FAISS (default) and optional Qdrant Cloud upgrade."""
|
| 15 |
|
| 16 |
def __init__(self, model_name: str = Config.EMBEDDING_MODEL):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
self.model = SentenceTransformer(model_name, device='cpu')
|
| 18 |
self.use_qdrant = Config.USE_QDRANT
|
| 19 |
|
|
|
|
| 14 |
"""Vector storage with FAISS (default) and optional Qdrant Cloud upgrade."""
|
| 15 |
|
| 16 |
def __init__(self, model_name: str = Config.EMBEDDING_MODEL):
|
| 17 |
+
import os
|
| 18 |
+
# Increase timeout for HF Spaces
|
| 19 |
+
os.environ['HF_HUB_DOWNLOAD_TIMEOUT'] = '300'
|
| 20 |
+
|
| 21 |
self.model = SentenceTransformer(model_name, device='cpu')
|
| 22 |
self.use_qdrant = Config.USE_QDRANT
|
| 23 |
|