VishnuRamDebyez
commited on
Commit
•
7c2021a
1
Parent(s):
fa51ed6
Update api_utils.py
Browse files- api_utils.py +4 -4
api_utils.py
CHANGED
@@ -14,7 +14,7 @@ def get_api_response(question, session_id, model):
|
|
14 |
data["session_id"] = session_id
|
15 |
|
16 |
try:
|
17 |
-
response = requests.post("http://localhost:
|
18 |
if response.status_code == 200:
|
19 |
return response.json()
|
20 |
else:
|
@@ -28,7 +28,7 @@ def upload_document(file):
|
|
28 |
print("Uploading file...")
|
29 |
try:
|
30 |
files = {"file": (file.name, file, file.type)}
|
31 |
-
response = requests.post("http://localhost:
|
32 |
if response.status_code == 200:
|
33 |
return response.json()
|
34 |
else:
|
@@ -40,7 +40,7 @@ def upload_document(file):
|
|
40 |
|
41 |
def list_documents():
|
42 |
try:
|
43 |
-
response = requests.get("http://localhost:
|
44 |
if response.status_code == 200:
|
45 |
return response.json()
|
46 |
else:
|
@@ -58,7 +58,7 @@ def delete_document(file_id):
|
|
58 |
data = {"file_id": file_id}
|
59 |
|
60 |
try:
|
61 |
-
response = requests.post("http://localhost:
|
62 |
if response.status_code == 200:
|
63 |
return response.json()
|
64 |
else:
|
|
|
14 |
data["session_id"] = session_id
|
15 |
|
16 |
try:
|
17 |
+
response = requests.post("http://localhost:8501/chat", headers=headers, json=data)
|
18 |
if response.status_code == 200:
|
19 |
return response.json()
|
20 |
else:
|
|
|
28 |
print("Uploading file...")
|
29 |
try:
|
30 |
files = {"file": (file.name, file, file.type)}
|
31 |
+
response = requests.post("http://localhost:8501/upload-doc", files=files)
|
32 |
if response.status_code == 200:
|
33 |
return response.json()
|
34 |
else:
|
|
|
40 |
|
41 |
def list_documents():
|
42 |
try:
|
43 |
+
response = requests.get("http://localhost:8501/list-docs")
|
44 |
if response.status_code == 200:
|
45 |
return response.json()
|
46 |
else:
|
|
|
58 |
data = {"file_id": file_id}
|
59 |
|
60 |
try:
|
61 |
+
response = requests.post("http://localhost:8501/delete-doc", headers=headers, json=data)
|
62 |
if response.status_code == 200:
|
63 |
return response.json()
|
64 |
else:
|