Penality commited on
Commit
81c492e
·
verified ·
1 Parent(s): e01694c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -14,7 +14,8 @@ from flask import jsonify
14
 
15
  load_dotenv()
16
 
17
- API_URL = f"https://b4e0-105-160-26-239.ngrok-free.app/embeddings"
 
18
 
19
  # FAISS index setup
20
  DIM = 768 # Adjust based on the embedding model
@@ -54,9 +55,12 @@ def store_document_data(PDF_FILE):
54
  index = faiss.IndexFlatL2(embedding.shape[1])
55
  index_file = "index.bin"
56
  faiss.write_index(index, index_file)
 
57
  with open(index_file, "rb") as f:
58
  response = requests.post(API_URL, files={"file": f})
59
 
 
 
60
  print("sent")
61
  except requests.exceptions.RequestException as e:
62
  return {"error": str(e)}
 
14
 
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
 
55
  index = faiss.IndexFlatL2(embedding.shape[1])
56
  index_file = "index.bin"
57
  faiss.write_index(index, index_file)
58
+ doc_index = index.ntotal - 1
59
  with open(index_file, "rb") as f:
60
  response = requests.post(API_URL, files={"file": f})
61
 
62
+ response = requests.post(API_URL_METADATA, data=doc_index)
63
+
64
  print("sent")
65
  except requests.exceptions.RequestException as e:
66
  return {"error": str(e)}