INNER CODE UNIT · Python
get_models
underneathall/pinferencia · pinferencia/frontend/app.py:71
def get_models(self) -> list:
warning_container = st.empty()
error = None
for i in range(10):
warning_container.info(
f"Backend is starting. Connecting to backend, attempt: {i + 1} / 10"
)
try:
models = [m["name"] for m in self.model_manager.list()]
warning_container.empty()
return models
except Exception as exc:
error = exc
if i < 9:
time.sleep(5)
st.warning(
"Please check if the backend is running, " "and refresh the page manually."
)