Spaces:
Runtime error
Runtime error
File size: 3,115 Bytes
4f07f72 dfe6290 f443824 dfe6290 c0f0676 f89cac3 dfe6290 c6ae5fd dfe6290 c6ae5fd c0f0676 c6ae5fd c0f0676 f89cac3 c6ae5fd dfe6290 c6ae5fd dfe6290 c6ae5fd dfe6290 c6ae5fd dfe6290 c6ae5fd dfe6290 c6ae5fd 5ecd875 c6ae5fd 38dd285 c6ae5fd |
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
"""
This page is password protected and allows admin users to perform several actions which
are not available to normal users (e.g. re-loading dynamically certain files or erasing files).
"""
import streamlit as st
from time import sleep
from src.st_helpers import st_setup
from src.common import *
from src.architectures import Architecture
from src.testing import TestGroup
if st_setup('LLM Arch'):
st.write("# System Status")
if 'admin_logged_in' not in st.session_state:
entered_pw = st.text_input(label="Enter the admin password to manage the system", type="password")
if st.button('Login'):
if entered_pw == st.secrets['admin_pw']:
st.session_state['admin_logged_in'] = True
st.rerun()
else:
st.error("Incorrect password")
else:
st.write("## Wipe Trace Logs")
if st.button("Wipe logs"):
Architecture.wipe_trace()
st.write('Note - wipe will only wipe the temporary file, DB persisted records will be saved')
st.divider()
if st.button("Reload traces"):
TestGroup.load_all(True)
st.divider()
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)
with button_col:
if st.button("Pause (to restart)", key=f'action_{i}'):
pause_hf_endpoint('alfraser', e)
st.rerun()
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()
|