Update app.py
Browse files
app.py
CHANGED
|
@@ -16,28 +16,20 @@ def is_api_up():
|
|
| 16 |
except:
|
| 17 |
return False
|
| 18 |
|
| 19 |
-
|
| 20 |
-
if st.session_state.namespace == "":
|
| 21 |
-
st.session_state.namespace = "library"
|
| 22 |
-
with warning:
|
| 23 |
-
st.warning("Namespace cannot be empty!")
|
| 24 |
-
|
| 25 |
-
st.text_input(
|
| 26 |
"Namespace",
|
| 27 |
-
|
| 28 |
-
value="library",
|
| 29 |
-
on_change=enforce_namespace
|
| 30 |
)
|
| 31 |
|
| 32 |
-
warning = st.empty()
|
| 33 |
-
|
| 34 |
if st.button("Make list"):
|
| 35 |
start_time = time.time()
|
| 36 |
|
| 37 |
if not is_api_up():
|
| 38 |
st.error("API is not reachable")
|
| 39 |
else:
|
| 40 |
-
|
|
|
|
|
|
|
| 41 |
library = r.json()["results"]
|
| 42 |
|
| 43 |
models = [model["model_base_name"] for model in library]
|
|
|
|
| 16 |
except:
|
| 17 |
return False
|
| 18 |
|
| 19 |
+
namespace = st.text_input(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
"Namespace",
|
| 21 |
+
value="library"
|
|
|
|
|
|
|
| 22 |
)
|
| 23 |
|
|
|
|
|
|
|
| 24 |
if st.button("Make list"):
|
| 25 |
start_time = time.time()
|
| 26 |
|
| 27 |
if not is_api_up():
|
| 28 |
st.error("API is not reachable")
|
| 29 |
else:
|
| 30 |
+
if not namespace:
|
| 31 |
+
st.warning("Namespace cannot be empty!")
|
| 32 |
+
r = requests.get(f"{HOST}/{namespace}")
|
| 33 |
library = r.json()["results"]
|
| 34 |
|
| 35 |
models = [model["model_base_name"] for model in library]
|