Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,6 @@ from flask import jsonify
|
|
| 15 |
load_dotenv()
|
| 16 |
|
| 17 |
API_URL_EMBEDDINGS = f"https://e4e5-196-96-202-255.ngrok-free.app/embeddings"
|
| 18 |
-
API_URL_METADATA = f"https://e4e5-196-96-202-255.ngrok-free.app/metadata"
|
| 19 |
|
| 20 |
# FAISS index setup
|
| 21 |
DIM = 768 # Adjust based on the embedding model
|
|
@@ -62,13 +61,11 @@ def store_document_data(PDF_FILE):
|
|
| 62 |
with open(index_file, "rb") as f:
|
| 63 |
response = requests.post(API_URL_EMBEDDINGS, files={"file": f})
|
| 64 |
|
| 65 |
-
response = requests.post(API_URL_METADATA, json={"doc_index": doc_index, "file": PDF_FILE})
|
| 66 |
-
|
| 67 |
print("sent")
|
| 68 |
except requests.exceptions.RequestException as e:
|
| 69 |
return {"error": str(e)}
|
| 70 |
|
| 71 |
-
return "
|
| 72 |
else:
|
| 73 |
return "No PDF file provided."
|
| 74 |
|
|
|
|
| 15 |
load_dotenv()
|
| 16 |
|
| 17 |
API_URL_EMBEDDINGS = f"https://e4e5-196-96-202-255.ngrok-free.app/embeddings"
|
|
|
|
| 18 |
|
| 19 |
# FAISS index setup
|
| 20 |
DIM = 768 # Adjust based on the embedding model
|
|
|
|
| 61 |
with open(index_file, "rb") as f:
|
| 62 |
response = requests.post(API_URL_EMBEDDINGS, files={"file": f})
|
| 63 |
|
|
|
|
|
|
|
| 64 |
print("sent")
|
| 65 |
except requests.exceptions.RequestException as e:
|
| 66 |
return {"error": str(e)}
|
| 67 |
|
| 68 |
+
return json={"doc_index": doc_index}
|
| 69 |
else:
|
| 70 |
return "No PDF file provided."
|
| 71 |
|