ynhe commited on
Commit
c3347ca
β€’
1 Parent(s): c4ab057

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -0
app.py CHANGED
@@ -129,6 +129,17 @@ def get_baseline_df():
129
  df = convert_scores_to_percentage(df)
130
  return df
131
 
 
 
 
 
 
 
 
 
 
 
 
132
  def get_all_df(selected_columns):
133
  submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
134
  submission_repo.git_pull()
@@ -178,6 +189,29 @@ def on_filter_model_size_method_change(selected_columns):
178
  )
179
  return filter_component#.value
180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  block = gr.Blocks()
182
 
183
 
@@ -186,6 +220,7 @@ with block:
186
  LEADERBORAD_INTRODUCTION
187
  )
188
  with gr.Tabs(elem_classes="tab-buttons") as tabs:
 
189
  with gr.TabItem("πŸ“Š VBench", elem_id="vbench-tab-table", id=1):
190
  with gr.Row():
191
  with gr.Accordion("Citation", open=False):
@@ -230,6 +265,28 @@ with block:
230
  disable_b.click(disable_all, inputs=None, outputs=[checkbox_group]).then(fn=on_filter_model_size_method_change, inputs=[ checkbox_group], outputs=data_component)
231
  checkbox_group.change(fn=on_filter_model_size_method_change, inputs=[ checkbox_group], outputs=data_component)
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  # table 2
234
  with gr.TabItem("πŸ“ About", elem_id="mvbench-tab-table", id=2):
235
  gr.Markdown(LEADERBORAD_INFO, elem_classes="markdown-text")
 
129
  df = convert_scores_to_percentage(df)
130
  return df
131
 
132
+ def get_baseline_df_quality():
133
+ submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
134
+ submission_repo.git_pull()
135
+ df = pd.read_csv(CSV_DIR)
136
+ df = get_final_score(df, checkbox_group.value)
137
+ df = df.sort_values(by="Selected Score", ascending=False)
138
+ present_columns = MODEL_INFO_TAB_QUALITY + checkbox_group_quality.value
139
+ df = df[present_columns]
140
+ df = convert_scores_to_percentage(df)
141
+ return df
142
+
143
  def get_all_df(selected_columns):
144
  submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
145
  submission_repo.git_pull()
 
189
  )
190
  return filter_component#.value
191
 
192
+ def on_filter_model_size_method_change_quality(selected_columns):
193
+ updated_data = get_baseline_df_quality(selected_columns)
194
+ #print(updated_data)
195
+ # columns:
196
+ selected_columns = [item for item in QUALITY_TAB if item in selected_columns]
197
+ present_columns = MODEL_INFO_TAB_QUALITY + selected_columns
198
+ updated_data = updated_data[present_columns]
199
+ updated_data = updated_data.sort_values(by="Selected Score", ascending=False)
200
+ updated_data = convert_scores_to_percentage(updated_data)
201
+ updated_headers = present_columns
202
+ update_datatype = [DATA_TITILE_TYPE[COLUMN_NAMES.index(x)] for x in updated_headers]
203
+ # print(updated_data,present_columns,update_datatype)
204
+ filter_component = gr.components.Dataframe(
205
+ value=updated_data,
206
+ headers=updated_headers,
207
+ type="pandas",
208
+ datatype=update_datatype,
209
+ interactive=False,
210
+ visible=True,
211
+ )
212
+ return filter_component#.value
213
+
214
+
215
  block = gr.Blocks()
216
 
217
 
 
220
  LEADERBORAD_INTRODUCTION
221
  )
222
  with gr.Tabs(elem_classes="tab-buttons") as tabs:
223
+ # Table 0
224
  with gr.TabItem("πŸ“Š VBench", elem_id="vbench-tab-table", id=1):
225
  with gr.Row():
226
  with gr.Accordion("Citation", open=False):
 
265
  disable_b.click(disable_all, inputs=None, outputs=[checkbox_group]).then(fn=on_filter_model_size_method_change, inputs=[ checkbox_group], outputs=data_component)
266
  checkbox_group.change(fn=on_filter_model_size_method_change, inputs=[ checkbox_group], outputs=data_component)
267
 
268
+ with gr.TabItem("Video Quaity", elem_id="vbench-tab-table", id=1):
269
+ with gr.Row():
270
+ with gr.Column(scale=1.0):
271
+ # selection for column part:
272
+ checkbox_group_quality = gr.CheckboxGroup(
273
+ choices=QUALITY_TAB,
274
+ value=QUALITY_TAB,
275
+ label="Evaluation Quality Dimension",
276
+ interactive=True,
277
+ )
278
+
279
+ data_component_quality = gr.components.Dataframe(
280
+ value=get_baseline_df_quality,
281
+ headers=COLUMN_NAMES_QUALITY,
282
+ type="pandas",
283
+ datatype=DATA_TITILE_TYPE,
284
+ interactive=False,
285
+ visible=True,
286
+ )
287
+
288
+ checkbox_group_quality.change(fn=on_filter_model_size_method_change_quality, inputs=[checkbox_group_quality], outputs=data_component_quality)
289
+
290
  # table 2
291
  with gr.TabItem("πŸ“ About", elem_id="mvbench-tab-table", id=2):
292
  gr.Markdown(LEADERBORAD_INFO, elem_classes="markdown-text")