Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -87,6 +87,12 @@ def retrieve_document(query):
|
|
| 87 |
print(f"Error fetching metadata: {metadata_.status_code} - {metadata_.text}")
|
| 88 |
return None
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
try:
|
| 91 |
# Convert response content to a byte stream
|
| 92 |
byte_stream = io.BytesIO(embeddings_.content)
|
|
@@ -103,12 +109,6 @@ def retrieve_document(query):
|
|
| 103 |
print(f"Error loading FAISS index: {e}")
|
| 104 |
return None
|
| 105 |
|
| 106 |
-
try:
|
| 107 |
-
metadata_file = metadata_.json()
|
| 108 |
-
except requests.exceptions.JSONDecodeError as e:
|
| 109 |
-
print(f"Error decoding metadata JSON: {e}")
|
| 110 |
-
return None
|
| 111 |
-
|
| 112 |
print(index, metadata_file)
|
| 113 |
|
| 114 |
# Generate query embedding
|
|
|
|
| 87 |
print(f"Error fetching metadata: {metadata_.status_code} - {metadata_.text}")
|
| 88 |
return None
|
| 89 |
|
| 90 |
+
try:
|
| 91 |
+
metadata_file = metadata_.json()
|
| 92 |
+
except requests.exceptions.JSONDecodeError as e:
|
| 93 |
+
print(f"Error decoding metadata JSON: {e}")
|
| 94 |
+
return None
|
| 95 |
+
|
| 96 |
try:
|
| 97 |
# Convert response content to a byte stream
|
| 98 |
byte_stream = io.BytesIO(embeddings_.content)
|
|
|
|
| 109 |
print(f"Error loading FAISS index: {e}")
|
| 110 |
return None
|
| 111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
print(index, metadata_file)
|
| 113 |
|
| 114 |
# Generate query embedding
|