Update app.py
Browse files
app.py
CHANGED
|
@@ -3,13 +3,17 @@ import requests
|
|
| 3 |
|
| 4 |
HOST = "https://1tsnakers-ollamasearchapi.hf.space"
|
| 5 |
|
| 6 |
-
|
|
|
|
| 7 |
r = requests.get(f"{HOST}/ping")
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
|
|
|
| 10 |
st.error(f"HTTP error {r.status_code}")
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
st.write(r.json())
|
| 15 |
|
|
|
|
| 3 |
|
| 4 |
HOST = "https://1tsnakers-ollamasearchapi.hf.space"
|
| 5 |
|
| 6 |
+
def is_api_up():
|
| 7 |
+
|
| 8 |
r = requests.get(f"{HOST}/ping")
|
| 9 |
+
|
| 10 |
+
return r.status_code == 200:
|
| 11 |
|
| 12 |
+
if st.button("make list"):
|
| 13 |
+
if !is_api_up():
|
| 14 |
st.error(f"HTTP error {r.status_code}")
|
| 15 |
+
else:
|
| 16 |
+
r = requests.get(f"{HOST}/library")
|
| 17 |
|
| 18 |
+
st.write(r.json())
|
|
|
|
|
|
|
| 19 |
|