Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,14 @@ import json
|
|
5 |
API_URL = "https://sendthat.cc"
|
6 |
|
7 |
def list_indexes():
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
def search_document(index_name, query, k):
|
13 |
url = f"{API_URL}/search/{index_name}"
|
|
|
5 |
API_URL = "https://sendthat.cc"
|
6 |
|
7 |
def list_indexes():
|
8 |
+
try:
|
9 |
+
url = f"{API_URL}/list_indexes"
|
10 |
+
response = requests.get(url)
|
11 |
+
response.raise_for_status() # This will raise an exception for HTTP errors
|
12 |
+
return response.json()
|
13 |
+
except requests.exceptions.RequestException as e:
|
14 |
+
print(f"Error fetching indexes: {e}")
|
15 |
+
return ["Error fetching indexes"] # Return a list with an error message
|
16 |
|
17 |
def search_document(index_name, query, k):
|
18 |
url = f"{API_URL}/search/{index_name}"
|