hysts HF staff commited on
Commit
1fa552c
·
1 Parent(s): 70a5579
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -50,11 +50,13 @@ OWNER_CHOICES = [WHOAMI, 'other organizations']
50
 
51
 
52
  def update_df(status: list[str], hardware: list[str], sdk: list[str],
53
- owner: list[str]) -> pd.DataFrame:
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 set(owner) == set(OWNER_CHOICES):
59
  pass
60
  elif WHOAMI in owner:
@@ -110,6 +112,7 @@ with gr.Blocks(css='style.css') as demo:
110
  choices=OWNER_CHOICES,
111
  value=OWNER_CHOICES,
112
  type='value')
 
113
  apply_button = gr.Button('Apply')
114
  df = gr.Dataframe(value=demo_list.df,
115
  datatype=demo_list.column_datatype,
@@ -133,8 +136,9 @@ with gr.Blocks(css='style.css') as demo:
133
  queue=False,
134
  show_progress=False,
135
  api_name=False)
136
- apply_button.click(fn=update_df,
137
- inputs=[status, hardware, sdk, owner],
138
- outputs=df,
139
- api_name=False)
 
140
  demo.queue(api_open=False).launch()
 
50
 
51
 
52
  def update_df(status: list[str], hardware: list[str], sdk: list[str],
53
+ owner: list[str], multiple_replicas: bool) -> pd.DataFrame:
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):
61
  pass
62
  elif WHOAMI in owner:
 
112
  choices=OWNER_CHOICES,
113
  value=OWNER_CHOICES,
114
  type='value')
115
+ multiple_replicas = gr.Checkbox(label='Multiple replicas', value=False)
116
  apply_button = gr.Button('Apply')
117
  df = gr.Dataframe(value=demo_list.df,
118
  datatype=demo_list.column_datatype,
 
136
  queue=False,
137
  show_progress=False,
138
  api_name=False)
139
+ apply_button.click(
140
+ fn=update_df,
141
+ inputs=[status, hardware, sdk, owner, multiple_replicas],
142
+ outputs=df,
143
+ api_name=False)
144
  demo.queue(api_open=False).launch()