Spaces:
Runtime error
Runtime error
Update
Browse files- app.py +37 -6
- demo_list.py +1 -1
app.py
CHANGED
@@ -46,15 +46,20 @@ SDK_CHOICES = [
|
|
46 |
'streamlit',
|
47 |
'docker',
|
48 |
]
|
|
|
|
|
49 |
OWNER_CHOICES = [WHOAMI, 'other organizations']
|
50 |
|
51 |
|
52 |
def update_df(status: list[str], hardware: list[str], sdk: list[str],
|
53 |
-
|
|
|
54 |
df_raw = demo_list.df_raw
|
55 |
df = demo_list.df
|
56 |
df = df[(df_raw.status.isin(status)) & (df_raw.hardware.isin(hardware)) &
|
57 |
(df_raw.sdk.isin(sdk))]
|
|
|
|
|
58 |
if multiple_replicas:
|
59 |
df = df[df_raw.replicas > 1]
|
60 |
if set(owner) == set(OWNER_CHOICES):
|
@@ -93,6 +98,15 @@ def update_sdk_checkboxes(choices: list[str]) -> list[str]:
|
|
93 |
return choices
|
94 |
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
with gr.Blocks(css='style.css') as demo:
|
97 |
with gr.Accordion(label='Filter', open=False):
|
98 |
status = gr.CheckboxGroup(label='Status',
|
@@ -108,6 +122,11 @@ with gr.Blocks(css='style.css') as demo:
|
|
108 |
choices=['(ALL)', '(NONE)'] + SDK_CHOICES,
|
109 |
value=SDK_CHOICES,
|
110 |
type='value')
|
|
|
|
|
|
|
|
|
|
|
111 |
owner = gr.CheckboxGroup(label='Owner',
|
112 |
choices=OWNER_CHOICES,
|
113 |
value=OWNER_CHOICES,
|
@@ -136,9 +155,21 @@ with gr.Blocks(css='style.css') as demo:
|
|
136 |
queue=False,
|
137 |
show_progress=False,
|
138 |
api_name=False)
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
demo.queue(api_open=False).launch()
|
|
|
46 |
'streamlit',
|
47 |
'docker',
|
48 |
]
|
49 |
+
SLEEP_TIME_CHOICES = list(demo_list.TO_TIME_STR.values())
|
50 |
+
SLEEP_TIME_STR_TO_INT = {v: k for k, v in demo_list.TO_TIME_STR.items()}
|
51 |
OWNER_CHOICES = [WHOAMI, 'other organizations']
|
52 |
|
53 |
|
54 |
def update_df(status: list[str], hardware: list[str], sdk: list[str],
|
55 |
+
sleep_time: list[str], owner: list[str],
|
56 |
+
multiple_replicas: bool) -> pd.DataFrame:
|
57 |
df_raw = demo_list.df_raw
|
58 |
df = demo_list.df
|
59 |
df = df[(df_raw.status.isin(status)) & (df_raw.hardware.isin(hardware)) &
|
60 |
(df_raw.sdk.isin(sdk))]
|
61 |
+
sleep_time_int = [SLEEP_TIME_STR_TO_INT[s] for s in sleep_time]
|
62 |
+
df = df[df_raw.sleep_time.isin(sleep_time_int)]
|
63 |
if multiple_replicas:
|
64 |
df = df[df_raw.replicas > 1]
|
65 |
if set(owner) == set(OWNER_CHOICES):
|
|
|
98 |
return choices
|
99 |
|
100 |
|
101 |
+
def update_sleep_time_checkboxes(choices: list[str]) -> list[str]:
|
102 |
+
if '(ALL)' in choices:
|
103 |
+
return SLEEP_TIME_CHOICES
|
104 |
+
elif '(NONE)' in choices:
|
105 |
+
return []
|
106 |
+
else:
|
107 |
+
return choices
|
108 |
+
|
109 |
+
|
110 |
with gr.Blocks(css='style.css') as demo:
|
111 |
with gr.Accordion(label='Filter', open=False):
|
112 |
status = gr.CheckboxGroup(label='Status',
|
|
|
122 |
choices=['(ALL)', '(NONE)'] + SDK_CHOICES,
|
123 |
value=SDK_CHOICES,
|
124 |
type='value')
|
125 |
+
sleep_time = gr.CheckboxGroup(label='Sleep time',
|
126 |
+
choices=['(ALL)', '(NONE)'] +
|
127 |
+
SLEEP_TIME_CHOICES,
|
128 |
+
value=SLEEP_TIME_CHOICES,
|
129 |
+
type='value')
|
130 |
owner = gr.CheckboxGroup(label='Owner',
|
131 |
choices=OWNER_CHOICES,
|
132 |
value=OWNER_CHOICES,
|
|
|
155 |
queue=False,
|
156 |
show_progress=False,
|
157 |
api_name=False)
|
158 |
+
sleep_time.change(fn=update_sleep_time_checkboxes,
|
159 |
+
inputs=sleep_time,
|
160 |
+
outputs=sleep_time,
|
161 |
+
queue=False,
|
162 |
+
show_progress=False,
|
163 |
+
api_name=False)
|
164 |
+
apply_button.click(fn=update_df,
|
165 |
+
inputs=[
|
166 |
+
status,
|
167 |
+
hardware,
|
168 |
+
sdk,
|
169 |
+
sleep_time,
|
170 |
+
owner,
|
171 |
+
multiple_replicas,
|
172 |
+
],
|
173 |
+
outputs=df,
|
174 |
+
api_name=False)
|
175 |
demo.queue(api_open=False).launch()
|
demo_list.py
CHANGED
@@ -30,7 +30,7 @@ class DemoList:
|
|
30 |
]
|
31 |
|
32 |
TO_TIME_STR = {
|
33 |
-
-1: '',
|
34 |
300: '5 minutes',
|
35 |
600: '10 minutes',
|
36 |
900: '15 minutes',
|
|
|
30 |
]
|
31 |
|
32 |
TO_TIME_STR = {
|
33 |
+
-1: 'null',
|
34 |
300: '5 minutes',
|
35 |
600: '10 minutes',
|
36 |
900: '15 minutes',
|