Spaces:
Sleeping
Sleeping
Commit
·
52b8a87
1
Parent(s):
7004832
Update app.py
Browse files
app.py
CHANGED
@@ -37,19 +37,22 @@ def persistent_load(pers_id):
|
|
37 |
raise HTTPException(status_code=500, detail=f"Unknown persistent ID: {pers_id}")
|
38 |
|
39 |
|
40 |
-
# Function to load models
|
41 |
def load_models():
|
42 |
try:
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
51 |
except Exception as e:
|
52 |
-
|
|
|
53 |
|
54 |
app = FastAPI()
|
55 |
|
|
|
37 |
raise HTTPException(status_code=500, detail=f"Unknown persistent ID: {pers_id}")
|
38 |
|
39 |
|
|
|
40 |
def load_models():
|
41 |
try:
|
42 |
+
with open('embeddings.pkl', 'rb') as f:
|
43 |
+
embeddings_data = pickle.load(f, encoding='latin1') # or 'bytes'
|
44 |
+
|
45 |
+
# If embeddings_data is a dictionary, check its content
|
46 |
+
if isinstance(embeddings_data, dict):
|
47 |
+
print("Loaded embeddings dictionary")
|
48 |
+
|
49 |
+
# Proceed with your logic using embeddings_data
|
50 |
+
# For example, assign to global models or something similar
|
51 |
+
global_models.embeddings_data = embeddings_data
|
52 |
+
|
53 |
except Exception as e:
|
54 |
+
print(f"Error loading embeddings data: {e}")
|
55 |
+
raise HTTPException(status_code=500, detail="Failed to load embeddings data.")
|
56 |
|
57 |
app = FastAPI()
|
58 |
|