Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -16,6 +16,9 @@ load_dotenv()
|
|
16 |
|
17 |
API_URL = f"https://b4e0-105-160-26-239.ngrok-free.app/post_embeddings"
|
18 |
|
|
|
|
|
|
|
19 |
# Set up Together.AI API Key (Replace with your actual key)
|
20 |
assert os.getenv("TOGETHER_API_KEY"), "api key missing"
|
21 |
|
@@ -48,7 +51,8 @@ def store_document_data(PDF_FILE):
|
|
48 |
print(f"sending to {API_URL}")
|
49 |
|
50 |
try:
|
51 |
-
|
|
|
52 |
response_data = response.json()
|
53 |
return response_data
|
54 |
except requests.exceptions.RequestException as e:
|
|
|
16 |
|
17 |
API_URL = f"https://b4e0-105-160-26-239.ngrok-free.app/post_embeddings"
|
18 |
|
19 |
+
# FAISS index setup
|
20 |
+
DIM = 768 # Adjust based on the embedding model
|
21 |
+
|
22 |
# Set up Together.AI API Key (Replace with your actual key)
|
23 |
assert os.getenv("TOGETHER_API_KEY"), "api key missing"
|
24 |
|
|
|
51 |
print(f"sending to {API_URL}")
|
52 |
|
53 |
try:
|
54 |
+
index = faiss.IndexFlatL2(embedding.shape[1])
|
55 |
+
response = requests.post(API_URL, json={"index": index})
|
56 |
response_data = response.json()
|
57 |
return response_data
|
58 |
except requests.exceptions.RequestException as e:
|