Spaces:
Runtime error
Runtime error
File size: 1,739 Bytes
dfe6290 f443824 dfe6290 38dd285 dfe6290 82150c1 dfe6290 38dd285 dfe6290 38dd285 f443824 38dd285 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
import streamlit as st
from time import sleep
from src.st_helpers import st_setup
from src.common import *
if st_setup('LLM Arch'):
st.write("# System Status")
st.write("## HF Inference Endpoint Statuses")
st.write("The following endpoints need to be running to run all the demonstrations.")
endpoints = st.secrets['endpoints'].split(',')
refresh = False
for i, e in enumerate(endpoints):
status = hf_endpoint_status('alfraser', e)
message = f'{e} ({status})'
if i != 0:
st.divider()
status_col, button_col = st.columns([2, 1])
if status == HF_RUNNING:
with status_col:
st.success(message)
with button_col:
if st.button("Pause", key=f'action_{i}'):
pause_hf_endpoint('alfraser', e)
st.rerun()
elif status == HF_SCALEDTOZERO:
with status_col:
st.error(message)
elif status == HF_PAUSED:
with status_col:
st.warning(message)
with button_col:
if st.button("Resume", key=f'action_{i}'):
resume_hf_endpoint('alfraser', e)
st.rerun()
elif status == HF_FAILED:
with status_col:
st.error(message)
else:
refresh = True
with status_col:
st.info(message)
with button_col:
if st.button("Pause", key=f'action_{i}'):
pause_hf_endpoint('alfraser', e)
st.rerun()
if refresh:
with st.spinner('Updating every 10 seconds...'):
sleep(10)
st.rerun()
|