Spaces:
Running
Running
Upload app.py
#8
by
Howieeeee
- opened
app.py
CHANGED
@@ -1,1056 +1,205 @@
|
|
1 |
-
__all__ = ['block', 'make_clickable_model', 'make_clickable_user', 'get_submissions']
|
2 |
-
import os
|
3 |
-
import io
|
4 |
import gradio as gr
|
|
|
5 |
import pandas as pd
|
6 |
-
import
|
7 |
-
import
|
8 |
-
|
9 |
-
import
|
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 |
-
cur_json = json.load(ff)
|
91 |
-
print(file, type(cur_json))
|
92 |
-
if isinstance(cur_json, dict):
|
93 |
-
print(cur_json.keys())
|
94 |
-
for key in cur_json:
|
95 |
-
upload_data[key.replace('_',' ')] = cur_json[key][0]
|
96 |
-
print(f"{key}:{cur_json[key][0]}")
|
97 |
-
elif cur_file.endswith('json'):
|
98 |
-
with open(cur_file) as ff:
|
99 |
-
cur_json = json.load(ff)
|
100 |
-
print(file, type(cur_json))
|
101 |
-
if isinstance(cur_json, dict):
|
102 |
-
print(cur_json.keys())
|
103 |
-
for key in cur_json:
|
104 |
-
upload_data[key.replace('_',' ')] = cur_json[key][0]
|
105 |
-
print(f"{key}:{cur_json[key][0]}")
|
106 |
-
# add new data
|
107 |
-
new_data = [model_name]
|
108 |
-
print('upload_data:', upload_data)
|
109 |
-
for key in TASK_INFO:
|
110 |
-
if key in upload_data:
|
111 |
-
new_data.append(upload_data[key])
|
112 |
-
else:
|
113 |
-
new_data.append(0)
|
114 |
-
if team_name =='' or 'vbench' in team_name.lower():
|
115 |
-
new_data.append("User Upload")
|
116 |
-
else:
|
117 |
-
new_data.append(team_name)
|
118 |
-
|
119 |
-
new_data.append(contact_email.replace(',',' and ')) # Add contact email [private]
|
120 |
-
new_data.append(update_time) # Add the update time
|
121 |
-
new_data.append(team_name)
|
122 |
-
new_data.append(access_type)
|
123 |
-
|
124 |
-
csv_data.loc[col] = new_data
|
125 |
-
csv_data = csv_data.to_csv(CSV_DIR, index=False)
|
126 |
-
with open(INFO_DIR,'a') as f:
|
127 |
-
f.write(f"{model_name}\t{update_time}\t{model_publish}\t{model_resolution}\t{model_fps}\t{model_frame}\t{model_video_length}\t{model_checkpoint}\t{model_commit_id}\t{model_video_format}\n")
|
128 |
-
submission_repo.push_to_hub()
|
129 |
-
print("success update", model_name)
|
130 |
-
return gr.update(visible=False), gr.update(visible=True), gr.update(visible=False)
|
131 |
-
|
132 |
-
def add_new_eval_i2v(
|
133 |
-
input_file,
|
134 |
-
model_name_textbox: str,
|
135 |
-
revision_name_textbox: str,
|
136 |
-
model_link: str,
|
137 |
-
team_name: str,
|
138 |
-
contact_email: str,
|
139 |
-
access_type: str,
|
140 |
-
model_publish: str,
|
141 |
-
model_resolution: str,
|
142 |
-
model_fps: str,
|
143 |
-
model_frame: str,
|
144 |
-
model_video_length: str,
|
145 |
-
model_checkpoint: str,
|
146 |
-
model_commit_id: str,
|
147 |
-
model_video_format: str
|
148 |
-
):
|
149 |
-
COLNAME2KEY={
|
150 |
-
"Video-Text Camera Motion":"camera_motion",
|
151 |
-
"Video-Image Subject Consistency": "i2v_subject",
|
152 |
-
"Video-Image Background Consistency": "i2v_background",
|
153 |
-
"Subject Consistency": "subject_consistency",
|
154 |
-
"Background Consistency": "background_consistency",
|
155 |
-
"Motion Smoothness": "motion_smoothness",
|
156 |
-
"Dynamic Degree": "dynamic_degree",
|
157 |
-
"Aesthetic Quality": "aesthetic_quality",
|
158 |
-
"Imaging Quality": "imaging_quality",
|
159 |
-
"Temporal Flickering": "temporal_flickering"
|
160 |
-
}
|
161 |
-
if input_file is None:
|
162 |
-
return "Error! Empty file!"
|
163 |
-
if model_link == '' or model_name_textbox == '' or contact_email == '':
|
164 |
-
return gr.update(visible=True), gr.update(visible=False), gr.update(visible=True)
|
165 |
-
|
166 |
-
upload_content = input_file
|
167 |
-
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
168 |
-
submission_repo.git_pull()
|
169 |
-
filename = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
170 |
-
|
171 |
-
now = datetime.datetime.now()
|
172 |
-
update_time = now.strftime("%Y-%m-%d") # Capture update time
|
173 |
-
with open(f'{SUBMISSION_NAME}/{filename}.zip','wb') as f:
|
174 |
-
f.write(input_file)
|
175 |
-
# shutil.copyfile(CSV_DIR, os.path.join(SUBMISSION_NAME, f"{input_file}"))
|
176 |
-
|
177 |
-
csv_data = pd.read_csv(I2V_DIR)
|
178 |
-
|
179 |
-
if revision_name_textbox == '':
|
180 |
-
col = csv_data.shape[0]
|
181 |
-
model_name = model_name_textbox.replace(',',' ')
|
182 |
-
else:
|
183 |
-
model_name = revision_name_textbox.replace(',',' ')
|
184 |
-
model_name_list = csv_data['Model Name (clickable)']
|
185 |
-
name_list = [name.split(']')[0][1:] for name in model_name_list]
|
186 |
-
if revision_name_textbox not in name_list:
|
187 |
-
col = csv_data.shape[0]
|
188 |
-
else:
|
189 |
-
col = name_list.index(revision_name_textbox)
|
190 |
-
if model_link == '':
|
191 |
-
model_name = model_name # no url
|
192 |
-
else:
|
193 |
-
model_name = '[' + model_name + '](' + model_link + ')'
|
194 |
-
|
195 |
-
os.makedirs(filename, exist_ok=True)
|
196 |
-
with zipfile.ZipFile(io.BytesIO(input_file), 'r') as zip_ref:
|
197 |
-
zip_ref.extractall(filename)
|
198 |
-
|
199 |
-
upload_data = {}
|
200 |
-
for file in os.listdir(filename):
|
201 |
-
if file.startswith('.') or file.startswith('__'):
|
202 |
-
print(f"Skip the file: {file}")
|
203 |
-
continue
|
204 |
-
cur_file = os.path.join(filename, file)
|
205 |
-
if os.path.isdir(cur_file):
|
206 |
-
for subfile in os.listdir(cur_file):
|
207 |
-
if subfile.endswith(".json"):
|
208 |
-
with open(os.path.join(cur_file, subfile)) as ff:
|
209 |
-
cur_json = json.load(ff)
|
210 |
-
print(file, type(cur_json))
|
211 |
-
if isinstance(cur_json, dict):
|
212 |
-
print(cur_json.keys())
|
213 |
-
for key in cur_json:
|
214 |
-
upload_data[key] = cur_json[key][0]
|
215 |
-
print(f"{key}:{cur_json[key][0]}")
|
216 |
-
elif cur_file.endswith('json'):
|
217 |
-
with open(cur_file) as ff:
|
218 |
-
cur_json = json.load(ff)
|
219 |
-
print(file, type(cur_json))
|
220 |
-
if isinstance(cur_json, dict):
|
221 |
-
print(cur_json.keys())
|
222 |
-
for key in cur_json:
|
223 |
-
upload_data[key] = cur_json[key][0]
|
224 |
-
print(f"{key}:{cur_json[key][0]}")
|
225 |
-
# add new data
|
226 |
-
new_data = [model_name]
|
227 |
-
print('upload_data:', upload_data)
|
228 |
-
I2V_HEAD= ["Video-Text Camera Motion",
|
229 |
-
"Video-Image Subject Consistency",
|
230 |
-
"Video-Image Background Consistency",
|
231 |
-
"Subject Consistency",
|
232 |
-
"Background Consistency",
|
233 |
-
"Temporal Flickering",
|
234 |
-
"Motion Smoothness",
|
235 |
-
"Dynamic Degree",
|
236 |
-
"Aesthetic Quality",
|
237 |
-
"Imaging Quality" ]
|
238 |
-
for key in I2V_HEAD :
|
239 |
-
sub_key = COLNAME2KEY[key]
|
240 |
-
if sub_key in upload_data:
|
241 |
-
new_data.append(upload_data[sub_key])
|
242 |
-
else:
|
243 |
-
new_data.append(0)
|
244 |
-
if team_name =='' or 'vbench' in team_name.lower():
|
245 |
-
new_data.append("User Upload")
|
246 |
-
else:
|
247 |
-
new_data.append(team_name)
|
248 |
-
|
249 |
-
new_data.append(contact_email.replace(',',' and ')) # Add contact email [private]
|
250 |
-
new_data.append(update_time) # Add the update time
|
251 |
-
new_data.append(team_name)
|
252 |
-
new_data.append(access_type)
|
253 |
-
|
254 |
-
csv_data.loc[col] = new_data
|
255 |
-
csv_data = csv_data.to_csv(I2V_DIR , index=False)
|
256 |
-
with open(INFO_DIR,'a') as f:
|
257 |
-
f.write(f"{model_name}\t{update_time}\t{model_publish}\t{model_resolution}\t{model_fps}\t{model_frame}\t{model_video_length}\t{model_checkpoint}\t{model_commit_id}\t{model_video_format}\n")
|
258 |
-
submission_repo.push_to_hub()
|
259 |
-
print("success update", model_name)
|
260 |
-
return gr.update(visible=False), gr.update(visible=True), gr.update(visible=False)
|
261 |
-
|
262 |
-
def get_normalized_df(df):
|
263 |
-
# final_score = df.drop('name', axis=1).sum(axis=1)
|
264 |
-
# df.insert(1, 'Overall Score', final_score)
|
265 |
-
normalize_df = df.copy().fillna(0.0)
|
266 |
-
for column in normalize_df.columns[1:-5]:
|
267 |
-
min_val = NORMALIZE_DIC[column]['Min']
|
268 |
-
max_val = NORMALIZE_DIC[column]['Max']
|
269 |
-
normalize_df[column] = (normalize_df[column] - min_val) / (max_val - min_val)
|
270 |
-
return normalize_df
|
271 |
-
|
272 |
-
def get_normalized_i2v_df(df):
|
273 |
-
normalize_df = df.copy().fillna(0.0)
|
274 |
-
for column in normalize_df.columns[1:-5]:
|
275 |
-
min_val = NORMALIZE_DIC_I2V[column]['Min']
|
276 |
-
max_val = NORMALIZE_DIC_I2V[column]['Max']
|
277 |
-
normalize_df[column] = (normalize_df[column] - min_val) / (max_val - min_val)
|
278 |
-
return normalize_df
|
279 |
-
|
280 |
-
|
281 |
-
def calculate_selected_score(df, selected_columns):
|
282 |
-
# selected_score = df[selected_columns].sum(axis=1)
|
283 |
-
selected_QUALITY = [i for i in selected_columns if i in QUALITY_LIST]
|
284 |
-
selected_SEMANTIC = [i for i in selected_columns if i in SEMANTIC_LIST]
|
285 |
-
selected_quality_score = df[selected_QUALITY].sum(axis=1)/sum([DIM_WEIGHT[i] for i in selected_QUALITY])
|
286 |
-
selected_semantic_score = df[selected_SEMANTIC].sum(axis=1)/sum([DIM_WEIGHT[i] for i in selected_SEMANTIC ])
|
287 |
-
if selected_quality_score.isna().any().any() and selected_semantic_score.isna().any().any():
|
288 |
-
selected_score = (selected_quality_score * QUALITY_WEIGHT + selected_semantic_score * SEMANTIC_WEIGHT) / (QUALITY_WEIGHT + SEMANTIC_WEIGHT)
|
289 |
-
return selected_score.fillna(0.0)
|
290 |
-
if selected_quality_score.isna().any().any():
|
291 |
-
return selected_semantic_score
|
292 |
-
if selected_semantic_score.isna().any().any():
|
293 |
-
return selected_quality_score
|
294 |
-
# print(selected_semantic_score,selected_quality_score )
|
295 |
-
selected_score = (selected_quality_score * QUALITY_WEIGHT + selected_semantic_score * SEMANTIC_WEIGHT) / (QUALITY_WEIGHT + SEMANTIC_WEIGHT)
|
296 |
-
return selected_score.fillna(0.0)
|
297 |
-
|
298 |
-
def calculate_selected_score_i2v(df, selected_columns):
|
299 |
-
# selected_score = df[selected_columns].sum(axis=1)
|
300 |
-
selected_QUALITY = [i for i in selected_columns if i in I2V_QUALITY_LIST]
|
301 |
-
selected_I2V = [i for i in selected_columns if i in I2V_LIST]
|
302 |
-
selected_quality_score = df[selected_QUALITY].sum(axis=1)/sum([DIM_WEIGHT_I2V[i] for i in selected_QUALITY])
|
303 |
-
selected_i2v_score = df[selected_I2V].sum(axis=1)/sum([DIM_WEIGHT_I2V[i] for i in selected_I2V ])
|
304 |
-
if selected_quality_score.isna().any().any() and selected_i2v_score.isna().any().any():
|
305 |
-
selected_score = (selected_quality_score * I2V_QUALITY_WEIGHT + selected_i2v_score * I2V_WEIGHT) / (I2V_QUALITY_WEIGHT + I2V_WEIGHT)
|
306 |
-
return selected_score.fillna(0.0)
|
307 |
-
if selected_quality_score.isna().any().any():
|
308 |
-
return selected_i2v_score
|
309 |
-
if selected_i2v_score.isna().any().any():
|
310 |
-
return selected_quality_score
|
311 |
-
# print(selected_i2v_score,selected_quality_score )
|
312 |
-
selected_score = (selected_quality_score * I2V_QUALITY_WEIGHT + selected_i2v_score * I2V_WEIGHT) / (I2V_QUALITY_WEIGHT + I2V_WEIGHT)
|
313 |
-
return selected_score.fillna(0.0)
|
314 |
-
|
315 |
-
def get_final_score(df, selected_columns):
|
316 |
-
normalize_df = get_normalized_df(df)
|
317 |
-
#final_score = normalize_df.drop('name', axis=1).sum(axis=1)
|
318 |
-
try:
|
319 |
-
for name in normalize_df.drop('Model Name (clickable)', axis=1).drop("Sampled by", axis=1).drop('Mail', axis=1).drop('Date',axis=1).drop("Evaluated by", axis=1).drop("Accessibility", axis=1):
|
320 |
-
normalize_df[name] = normalize_df[name]*DIM_WEIGHT[name]
|
321 |
-
except:
|
322 |
-
for name in normalize_df.drop('Model Name (clickable)', axis=1).drop("Sampled by", axis=1).drop('Mail', axis=1).drop('Date',axis=1):
|
323 |
-
normalize_df[name] = normalize_df[name]*DIM_WEIGHT[name]
|
324 |
-
quality_score = normalize_df[QUALITY_LIST].sum(axis=1)/sum([DIM_WEIGHT[i] for i in QUALITY_LIST])
|
325 |
-
semantic_score = normalize_df[SEMANTIC_LIST].sum(axis=1)/sum([DIM_WEIGHT[i] for i in SEMANTIC_LIST ])
|
326 |
-
final_score = (quality_score * QUALITY_WEIGHT + semantic_score * SEMANTIC_WEIGHT) / (QUALITY_WEIGHT + SEMANTIC_WEIGHT)
|
327 |
-
if 'Total Score' in df:
|
328 |
-
df['Total Score'] = final_score
|
329 |
-
else:
|
330 |
-
df.insert(1, 'Total Score', final_score)
|
331 |
-
if 'Semantic Score' in df:
|
332 |
-
df['Semantic Score'] = semantic_score
|
333 |
-
else:
|
334 |
-
df.insert(2, 'Semantic Score', semantic_score)
|
335 |
-
if 'Quality Score' in df:
|
336 |
-
df['Quality Score'] = quality_score
|
337 |
-
else:
|
338 |
-
df.insert(3, 'Quality Score', quality_score)
|
339 |
-
selected_score = calculate_selected_score(normalize_df, selected_columns)
|
340 |
-
if 'Selected Score' in df:
|
341 |
-
df['Selected Score'] = selected_score
|
342 |
-
else:
|
343 |
-
df.insert(1, 'Selected Score', selected_score)
|
344 |
-
return df
|
345 |
-
|
346 |
-
def get_final_score_i2v(df, selected_columns):
|
347 |
-
normalize_df = get_normalized_i2v_df(df)
|
348 |
-
try:
|
349 |
-
for name in normalize_df.drop('Model Name (clickable)', axis=1).drop("Sampled by", axis=1).drop('Mail', axis=1).drop('Date',axis=1).drop("Evaluated by", axis=1).drop("Accessibility", axis=1):
|
350 |
-
normalize_df[name] = normalize_df[name]*DIM_WEIGHT_I2V[name]
|
351 |
-
except:
|
352 |
-
for name in normalize_df.drop('Model Name (clickable)', axis=1).drop("Sampled by", axis=1).drop('Mail', axis=1).drop('Date',axis=1):
|
353 |
-
normalize_df[name] = normalize_df[name]*DIM_WEIGHT_I2V[name]
|
354 |
-
quality_score = normalize_df[I2V_QUALITY_LIST].sum(axis=1)/sum([DIM_WEIGHT_I2V[i] for i in I2V_QUALITY_LIST])
|
355 |
-
i2v_score = normalize_df[I2V_LIST].sum(axis=1)/sum([DIM_WEIGHT_I2V[i] for i in I2V_LIST ])
|
356 |
-
final_score = (quality_score * I2V_QUALITY_WEIGHT + i2v_score * I2V_WEIGHT) / (I2V_QUALITY_WEIGHT + I2V_WEIGHT)
|
357 |
-
if 'Total Score' in df:
|
358 |
-
df['Total Score'] = final_score
|
359 |
-
else:
|
360 |
-
df.insert(1, 'Total Score', final_score)
|
361 |
-
if 'I2V Score' in df:
|
362 |
-
df['I2V Score'] = i2v_score
|
363 |
-
else:
|
364 |
-
df.insert(2, 'I2V Score', i2v_score)
|
365 |
-
if 'Quality Score' in df:
|
366 |
-
df['Quality Score'] = quality_score
|
367 |
-
else:
|
368 |
-
df.insert(3, 'Quality Score', quality_score)
|
369 |
-
selected_score = calculate_selected_score_i2v(normalize_df, selected_columns)
|
370 |
-
if 'Selected Score' in df:
|
371 |
-
df['Selected Score'] = selected_score
|
372 |
-
else:
|
373 |
-
df.insert(1, 'Selected Score', selected_score)
|
374 |
-
# df.loc[df[9:].isnull().any(axis=1), ['Total Score', 'I2V Score']] = 'N.A.'
|
375 |
-
mask = df.iloc[:, 5:-5].isnull().any(axis=1)
|
376 |
-
df.loc[mask, ['Total Score', 'I2V Score','Selected Score' ]] = np.nan
|
377 |
-
# df.fillna('N.A.', inplace=True)
|
378 |
-
return df
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
def get_final_score_quality(df, selected_columns):
|
383 |
-
normalize_df = get_normalized_df(df)
|
384 |
-
for name in normalize_df.drop('Model Name (clickable)', axis=1):
|
385 |
-
normalize_df[name] = normalize_df[name]*DIM_WEIGHT[name]
|
386 |
-
quality_score = normalize_df[QUALITY_TAB].sum(axis=1) / sum([DIM_WEIGHT[i] for i in QUALITY_TAB])
|
387 |
-
|
388 |
-
if 'Quality Score' in df:
|
389 |
-
df['Quality Score'] = quality_score
|
390 |
-
else:
|
391 |
-
df.insert(1, 'Quality Score', quality_score)
|
392 |
-
# selected_score = normalize_df[selected_columns].sum(axis=1) / len(selected_columns)
|
393 |
-
selected_score = normalize_df[selected_columns].sum(axis=1)/sum([DIM_WEIGHT[i] for i in selected_columns])
|
394 |
-
if 'Selected Score' in df:
|
395 |
-
df['Selected Score'] = selected_score
|
396 |
-
else:
|
397 |
-
df.insert(1, 'Selected Score', selected_score)
|
398 |
-
return df
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
def get_baseline_df():
|
403 |
-
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
404 |
-
submission_repo.git_pull()
|
405 |
-
df = pd.read_csv(CSV_DIR)
|
406 |
-
df = get_final_score(df, checkbox_group.value)
|
407 |
-
df = df.sort_values(by="Selected Score", ascending=False)
|
408 |
-
present_columns = MODEL_INFO + checkbox_group.value
|
409 |
-
# print(present_columns)
|
410 |
-
df = df[present_columns]
|
411 |
-
# Add this line to display the results evaluated by VBench by default
|
412 |
-
df = df[df['Evaluated by'] == 'VBench Team']
|
413 |
-
df = convert_scores_to_percentage(df)
|
414 |
-
return df
|
415 |
-
|
416 |
-
def get_baseline_df_quality():
|
417 |
-
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
418 |
-
submission_repo.git_pull()
|
419 |
-
df = pd.read_csv(QUALITY_DIR)
|
420 |
-
df = get_final_score_quality(df, checkbox_group_quality.value)
|
421 |
-
df = df.sort_values(by="Selected Score", ascending=False)
|
422 |
-
present_columns = MODEL_INFO_TAB_QUALITY + checkbox_group_quality.value
|
423 |
-
df = df[present_columns]
|
424 |
-
df = convert_scores_to_percentage(df)
|
425 |
-
return df
|
426 |
-
|
427 |
-
def get_baseline_df_i2v():
|
428 |
-
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
429 |
-
submission_repo.git_pull()
|
430 |
-
df = pd.read_csv(I2V_DIR)
|
431 |
-
df = get_final_score_i2v(df, checkbox_group_i2v.value)
|
432 |
-
df = df.sort_values(by="Selected Score", ascending=False)
|
433 |
-
present_columns = MODEL_INFO_TAB_I2V + checkbox_group_i2v.value
|
434 |
-
# df = df[df["Sampled by"] == 'VBench Team']
|
435 |
-
df = df[present_columns]
|
436 |
-
df = convert_scores_to_percentage(df)
|
437 |
-
return df
|
438 |
-
|
439 |
-
def get_baseline_df_long():
|
440 |
-
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
441 |
-
submission_repo.git_pull()
|
442 |
-
df = pd.read_csv(LONG_DIR)
|
443 |
-
df = get_final_score(df, checkbox_group.value)
|
444 |
-
df = df.sort_values(by="Selected Score", ascending=False)
|
445 |
-
present_columns = MODEL_INFO + checkbox_group.value
|
446 |
-
# df = df[df["Sampled by"] == 'VBench Team']
|
447 |
-
df = df[present_columns]
|
448 |
-
df = convert_scores_to_percentage(df)
|
449 |
-
return df
|
450 |
-
|
451 |
-
def get_baseline_df_2():
|
452 |
-
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
453 |
-
submission_repo.git_pull()
|
454 |
-
df = pd.read_csv(VBENCH2_DIR)
|
455 |
-
# df = get_final_score(df, checkbox_group.value)
|
456 |
-
# df = df.sort_values(by="Selected Score", ascending=False)
|
457 |
-
# present_columns = MODEL_INFO + checkbox_group.value
|
458 |
-
# print(present_columns)
|
459 |
-
df = df[COLUMN_NAMES_2]
|
460 |
-
# Add this line to display the results evaluated by VBench by default
|
461 |
-
df = convert_scores_to_percentage(df)
|
462 |
-
return df
|
463 |
-
|
464 |
-
def get_all_df(selected_columns, dir=CSV_DIR):
|
465 |
-
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
466 |
-
submission_repo.git_pull()
|
467 |
-
df = pd.read_csv(dir)
|
468 |
-
df = get_final_score(df, selected_columns)
|
469 |
-
df = df.sort_values(by="Selected Score", ascending=False)
|
470 |
-
return df
|
471 |
-
|
472 |
-
def get_all_df_quality(selected_columns, dir=QUALITY_DIR):
|
473 |
-
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
474 |
-
submission_repo.git_pull()
|
475 |
-
df = pd.read_csv(dir)
|
476 |
-
df = get_final_score_quality(df, selected_columns)
|
477 |
-
df = df.sort_values(by="Selected Score", ascending=False)
|
478 |
-
return df
|
479 |
-
|
480 |
-
def get_all_df_i2v(selected_columns, dir=I2V_DIR):
|
481 |
-
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
482 |
-
submission_repo.git_pull()
|
483 |
-
df = pd.read_csv(dir)
|
484 |
-
df = get_final_score_i2v(df, selected_columns)
|
485 |
-
df = df.sort_values(by="Selected Score", ascending=False)
|
486 |
-
return df
|
487 |
-
|
488 |
-
def get_all_df_long(selected_columns, dir=LONG_DIR):
|
489 |
-
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
490 |
-
submission_repo.git_pull()
|
491 |
-
df = pd.read_csv(dir)
|
492 |
-
df = get_final_score(df, selected_columns)
|
493 |
-
df = df.sort_values(by="Selected Score", ascending=False)
|
494 |
-
return df
|
495 |
-
|
496 |
-
def get_all_df2(dir=VBENCH2_DIR):
|
497 |
-
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
498 |
-
submission_repo.git_pull()
|
499 |
-
df = pd.read_csv(dir)
|
500 |
-
# df = get_final_score(df, selected_columns)
|
501 |
-
# df = df.sort_values(by="Selected Score", ascending=False)
|
502 |
-
return df
|
503 |
-
|
504 |
-
|
505 |
-
def convert_scores_to_percentage(df):
|
506 |
-
# Operate on every column in the DataFrame (except the'name 'column)
|
507 |
-
if "Sampled by" in df.columns:
|
508 |
-
skip_col =3
|
509 |
-
else:
|
510 |
-
skip_col =1
|
511 |
-
print(df)
|
512 |
-
for column in df.columns[skip_col:]: # 假设第一列是'name'
|
513 |
-
# if df[column].isdigit():
|
514 |
-
# print(df[column])
|
515 |
-
# is_numeric = pd.to_numeric(df[column], errors='coerce').notna().all()
|
516 |
-
valid_numeric_count = pd.to_numeric(df[column], errors='coerce').notna().sum()
|
517 |
-
if valid_numeric_count > 0:
|
518 |
-
df[column] = round(df[column] * 100,2)
|
519 |
-
df[column] = df[column].apply(lambda x: f"{x:05.2f}%" if pd.notna(pd.to_numeric(x, errors='coerce')) else x)
|
520 |
-
# df[column] = df[column].apply(lambda x: f"{x:05.2f}") + '%'
|
521 |
-
return df
|
522 |
-
|
523 |
-
def choose_all_quailty():
|
524 |
-
return gr.update(value=QUALITY_LIST)
|
525 |
-
|
526 |
-
def choose_all_semantic():
|
527 |
-
return gr.update(value=SEMANTIC_LIST)
|
528 |
-
|
529 |
-
def disable_all():
|
530 |
-
return gr.update(value=[])
|
531 |
-
|
532 |
-
def enable_all():
|
533 |
-
return gr.update(value=TASK_INFO)
|
534 |
-
|
535 |
-
# select function
|
536 |
-
def on_filter_model_size_method_change(selected_columns, vbench_team_sample, vbench_team_eval=False):
|
537 |
-
updated_data = get_all_df(selected_columns, CSV_DIR)
|
538 |
-
if vbench_team_sample:
|
539 |
-
updated_data = updated_data[updated_data["Sampled by"] == 'VBench Team']
|
540 |
-
if vbench_team_eval:
|
541 |
-
updated_data = updated_data[updated_data['Evaluated by'] == 'VBench Team']
|
542 |
-
#print(updated_data)
|
543 |
-
# columns:
|
544 |
-
selected_columns = [item for item in TASK_INFO if item in selected_columns]
|
545 |
-
present_columns = MODEL_INFO + selected_columns
|
546 |
-
updated_data = updated_data[present_columns]
|
547 |
-
updated_data = updated_data.sort_values(by="Selected Score", ascending=False)
|
548 |
-
updated_data = convert_scores_to_percentage(updated_data)
|
549 |
-
updated_headers = present_columns
|
550 |
-
print(COLUMN_NAMES,updated_headers,DATA_TITILE_TYPE )
|
551 |
-
update_datatype = [DATA_TITILE_TYPE[COLUMN_NAMES.index(x)] for x in updated_headers]
|
552 |
-
# print(updated_data,present_columns,update_datatype)
|
553 |
-
filter_component = gr.components.Dataframe(
|
554 |
-
value=updated_data,
|
555 |
-
headers=updated_headers,
|
556 |
-
type="pandas",
|
557 |
-
datatype=update_datatype,
|
558 |
-
interactive=False,
|
559 |
-
visible=True,
|
560 |
-
)
|
561 |
-
return filter_component#.value
|
562 |
-
|
563 |
-
def on_filter_model_size_method_change_quality(selected_columns):
|
564 |
-
updated_data = get_all_df_quality(selected_columns, QUALITY_DIR)
|
565 |
-
#print(updated_data)
|
566 |
-
# columns:
|
567 |
-
selected_columns = [item for item in QUALITY_TAB if item in selected_columns]
|
568 |
-
present_columns = MODEL_INFO_TAB_QUALITY + selected_columns
|
569 |
-
updated_data = updated_data[present_columns]
|
570 |
-
updated_data = updated_data.sort_values(by="Selected Score", ascending=False)
|
571 |
-
updated_data = convert_scores_to_percentage(updated_data)
|
572 |
-
updated_headers = present_columns
|
573 |
-
update_datatype = [DATA_TITILE_TYPE[COLUMN_NAMES.index(x)] for x in updated_headers]
|
574 |
-
# print(updated_data,present_columns,update_datatype)
|
575 |
-
filter_component = gr.components.Dataframe(
|
576 |
-
value=updated_data,
|
577 |
-
headers=updated_headers,
|
578 |
-
type="pandas",
|
579 |
-
datatype=update_datatype,
|
580 |
-
interactive=False,
|
581 |
-
visible=True,
|
582 |
-
)
|
583 |
-
return filter_component#.value
|
584 |
-
|
585 |
-
def on_filter_model_size_method_change_i2v(selected_columns,vbench_team_sample, vbench_team_eval=False):
|
586 |
-
updated_data = get_all_df_i2v(selected_columns, I2V_DIR)
|
587 |
-
if vbench_team_sample:
|
588 |
-
updated_data = updated_data[updated_data["Sampled by"] == 'VBench Team']
|
589 |
-
# if vbench_team_eval:
|
590 |
-
# updated_data = updated_data[updated_data['Eval'] == 'VBench Team']
|
591 |
-
selected_columns = [item for item in I2V_TAB if item in selected_columns]
|
592 |
-
present_columns = MODEL_INFO_TAB_I2V + selected_columns
|
593 |
-
updated_data = updated_data[present_columns]
|
594 |
-
updated_data = updated_data.sort_values(by="Selected Score", ascending=False)
|
595 |
-
updated_data = convert_scores_to_percentage(updated_data)
|
596 |
-
updated_headers = present_columns
|
597 |
-
update_datatype = [DATA_TITILE_TYPE[COLUMN_NAMES_I2V.index(x)] for x in updated_headers]
|
598 |
-
# print(updated_data,present_columns,update_datatype)
|
599 |
-
filter_component = gr.components.Dataframe(
|
600 |
-
value=updated_data,
|
601 |
-
headers=updated_headers,
|
602 |
-
type="pandas",
|
603 |
-
datatype=update_datatype,
|
604 |
-
interactive=False,
|
605 |
-
visible=True,
|
606 |
-
)
|
607 |
-
return filter_component#.value
|
608 |
-
|
609 |
-
def on_filter_model_size_method_change_long(selected_columns, vbench_team_sample, vbench_team_eval=False):
|
610 |
-
updated_data = get_all_df_long(selected_columns, LONG_DIR)
|
611 |
-
if vbench_team_sample:
|
612 |
-
updated_data = updated_data[updated_data["Sampled by"] == 'VBench Team']
|
613 |
-
if vbench_team_eval:
|
614 |
-
updated_data = updated_data[updated_data['Evaluated by'] == 'VBench Team']
|
615 |
-
selected_columns = [item for item in TASK_INFO if item in selected_columns]
|
616 |
-
present_columns = MODEL_INFO + selected_columns
|
617 |
-
updated_data = updated_data[present_columns]
|
618 |
-
updated_data = updated_data.sort_values(by="Selected Score", ascending=False)
|
619 |
-
updated_data = convert_scores_to_percentage(updated_data)
|
620 |
-
updated_headers = present_columns
|
621 |
-
update_datatype = [DATA_TITILE_TYPE[COLUMN_NAMES.index(x)] for x in updated_headers]
|
622 |
-
filter_component = gr.components.Dataframe(
|
623 |
-
value=updated_data,
|
624 |
-
headers=updated_headers,
|
625 |
-
type="pandas",
|
626 |
-
datatype=update_datatype,
|
627 |
-
interactive=False,
|
628 |
-
visible=True,
|
629 |
-
)
|
630 |
-
return filter_component#.value
|
631 |
-
|
632 |
-
|
633 |
-
def on_filter_model_size_method_change_2(vbench_team_sample, vbench_team_eval=False):
|
634 |
-
updated_data = get_all_df(VBENCH2_DIR)
|
635 |
-
if vbench_team_sample:
|
636 |
-
updated_data = updated_data[updated_data["Sampled by"] == 'VBench Team']
|
637 |
-
if vbench_team_eval:
|
638 |
-
updated_data = updated_data[updated_data['Evaluated by'] == 'VBench Team']
|
639 |
-
#print(updated_data)
|
640 |
-
# columns:
|
641 |
-
# selected_columns = [item for item in TASK_INFO if item in selected_columns]
|
642 |
-
# present_columns = MODEL_INFO + selected_columns
|
643 |
-
# updated_data = updated_data[present_columns]
|
644 |
-
# updated_data = updated_data.sort_values(by="Selected Score", ascending=False)
|
645 |
-
# updated_data = convert_scores_to_percentage(updated_data)
|
646 |
-
updated_headers = COLUMN_NAMES_2
|
647 |
-
# print(COLUMN_NAMES,updated_headers,DATA_TITILE_TYPE )
|
648 |
-
update_datatype = VBENCH2_TITLE_TYPE
|
649 |
-
# print(updated_data,present_columns,update_datatype)
|
650 |
-
filter_component = gr.components.Dataframe(
|
651 |
-
value=updated_data,
|
652 |
-
headers=updated_headers,
|
653 |
-
type="pandas",
|
654 |
-
datatype=update_datatype,
|
655 |
interactive=False,
|
656 |
-
visible=True,
|
657 |
-
)
|
658 |
-
return filter_component#.value
|
659 |
-
|
660 |
-
block = gr.Blocks()
|
661 |
-
|
662 |
-
|
663 |
-
with block:
|
664 |
-
gr.Markdown(
|
665 |
-
LEADERBORAD_INTRODUCTION
|
666 |
)
|
667 |
-
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
668 |
-
# Table 0
|
669 |
-
with gr.TabItem("📊 VBench 1.0", elem_id="vbench-tab-table", id=1):
|
670 |
-
with gr.Row():
|
671 |
-
with gr.Accordion("Citation", open=False):
|
672 |
-
citation_button = gr.Textbox(
|
673 |
-
value=CITATION_BUTTON_TEXT,
|
674 |
-
label=CITATION_BUTTON_LABEL,
|
675 |
-
elem_id="citation-button",
|
676 |
-
lines=14,
|
677 |
-
)
|
678 |
-
|
679 |
-
gr.Markdown(
|
680 |
-
TABLE_INTRODUCTION
|
681 |
-
)
|
682 |
-
with gr.Row():
|
683 |
-
with gr.Column(scale=0.2):
|
684 |
-
choosen_q = gr.Button("Select Quality Dimensions")
|
685 |
-
choosen_s = gr.Button("Select Semantic Dimensions")
|
686 |
-
# enable_b = gr.Button("Select All")
|
687 |
-
disable_b = gr.Button("Deselect All")
|
688 |
|
689 |
-
with gr.Column(scale=0.8):
|
690 |
-
vbench_team_filter = gr.Checkbox(
|
691 |
-
label="Sampled by VBench Team (Uncheck to view all submissions)",
|
692 |
-
value=False,
|
693 |
-
interactive=True
|
694 |
-
)
|
695 |
-
vbench_validate_filter = gr.Checkbox(
|
696 |
-
label="Evaluated by VBench Team (Uncheck to view all submissions)",
|
697 |
-
value=True,
|
698 |
-
interactive=True
|
699 |
-
)
|
700 |
-
# selection for column part:
|
701 |
-
checkbox_group = gr.CheckboxGroup(
|
702 |
-
choices=TASK_INFO,
|
703 |
-
value=DEFAULT_INFO,
|
704 |
-
label="Evaluation Dimension",
|
705 |
-
interactive=True,
|
706 |
-
)
|
707 |
-
|
708 |
-
data_component = gr.components.Dataframe(
|
709 |
-
value=get_baseline_df,
|
710 |
-
headers=COLUMN_NAMES,
|
711 |
-
type="pandas",
|
712 |
-
datatype=DATA_TITILE_TYPE,
|
713 |
-
interactive=False,
|
714 |
-
visible=True,
|
715 |
-
height=700,
|
716 |
-
)
|
717 |
-
|
718 |
-
choosen_q.click(choose_all_quailty, inputs=None, outputs=[checkbox_group]).then(fn=on_filter_model_size_method_change, inputs=[ checkbox_group, vbench_team_filter,vbench_validate_filter], outputs=data_component)
|
719 |
-
choosen_s.click(choose_all_semantic, inputs=None, outputs=[checkbox_group]).then(fn=on_filter_model_size_method_change, inputs=[ checkbox_group, vbench_team_filter,vbench_validate_filter], outputs=data_component)
|
720 |
-
# enable_b.click(enable_all, inputs=None, outputs=[checkbox_group]).then(fn=on_filter_model_size_method_change, inputs=[ checkbox_group, vbench_team_filter], outputs=data_component)
|
721 |
-
disable_b.click(disable_all, inputs=None, outputs=[checkbox_group]).then(fn=on_filter_model_size_method_change, inputs=[ checkbox_group, vbench_team_filter, vbench_validate_filter], outputs=data_component)
|
722 |
-
checkbox_group.change(fn=on_filter_model_size_method_change, inputs=[ checkbox_group, vbench_team_filter, vbench_validate_filter], outputs=data_component)
|
723 |
-
vbench_team_filter.change(fn=on_filter_model_size_method_change, inputs=[checkbox_group, vbench_team_filter, vbench_validate_filter], outputs=data_component)
|
724 |
-
vbench_validate_filter.change(fn=on_filter_model_size_method_change, inputs=[checkbox_group, vbench_team_filter, vbench_validate_filter], outputs=data_component)
|
725 |
-
# VBench 2.0
|
726 |
-
with gr.TabItem("⭐ VBench 2.0", elem_id="vbench-tab-table", id=2):
|
727 |
-
with gr.Row():
|
728 |
-
with gr.Accordion("Citation", open=False):
|
729 |
-
citation_button2 = gr.Textbox(
|
730 |
-
value=CITATION_2_BUTTON_TEXT,
|
731 |
-
label=CITATION_BUTTON_LABEL,
|
732 |
-
elem_id="citation-button",
|
733 |
-
lines=14,
|
734 |
-
)
|
735 |
-
|
736 |
-
gr.Markdown(
|
737 |
-
TABLE_INTRODUCTION
|
738 |
-
)
|
739 |
-
with gr.Row():
|
740 |
-
with gr.Column():
|
741 |
-
vbench_team_filter_2 = gr.Checkbox(
|
742 |
-
label="Sampled by VBench Team (Uncheck to view all submissions)",
|
743 |
-
value=False,
|
744 |
-
interactive=True
|
745 |
-
)
|
746 |
-
vbench_validate_filter_2 = gr.Checkbox(
|
747 |
-
label="Evaluated by VBench Team (Uncheck to view all submissions)",
|
748 |
-
value=True,
|
749 |
-
interactive=True
|
750 |
-
)
|
751 |
-
|
752 |
-
|
753 |
-
data_component_2 = gr.components.Dataframe(
|
754 |
-
value=get_baseline_df_2,
|
755 |
-
headers=COLUMN_NAMES_2,
|
756 |
-
type="pandas",
|
757 |
-
datatype=VBENCH2_TITLE_TYPE,
|
758 |
-
interactive=False,
|
759 |
-
visible=True,
|
760 |
-
height=700,
|
761 |
-
)
|
762 |
-
vbench_team_filter.change(fn=on_filter_model_size_method_change_2, inputs=[vbench_team_filter_2, vbench_validate_filter], outputs=data_component_2)
|
763 |
-
vbench_validate_filter.change(fn=on_filter_model_size_method_change_2, inputs=[vbench_team_filter_2, vbench_validate_filter], outputs=data_component_2)
|
764 |
-
|
765 |
-
with gr.TabItem("Video Quality", elem_id="vbench-tab-table", id=3):
|
766 |
-
with gr.Accordion("INSTRUCTION", open=False):
|
767 |
-
citation_button = gr.Textbox(
|
768 |
-
value=QUALITY_CLAIM_TEXT,
|
769 |
-
label="",
|
770 |
-
elem_id="quality-button",
|
771 |
-
lines=2,
|
772 |
-
)
|
773 |
-
with gr.Row():
|
774 |
-
with gr.Column(scale=1.0):
|
775 |
-
# selection for column part:
|
776 |
-
|
777 |
-
checkbox_group_quality = gr.CheckboxGroup(
|
778 |
-
choices=QUALITY_TAB,
|
779 |
-
value=QUALITY_TAB,
|
780 |
-
label="Evaluation Quality Dimension",
|
781 |
-
interactive=True,
|
782 |
-
)
|
783 |
-
|
784 |
-
data_component_quality = gr.components.Dataframe(
|
785 |
-
value=get_baseline_df_quality,
|
786 |
-
headers=COLUMN_NAMES_QUALITY,
|
787 |
-
type="pandas",
|
788 |
-
datatype=DATA_TITILE_TYPE,
|
789 |
-
interactive=False,
|
790 |
-
visible=True,
|
791 |
-
)
|
792 |
-
|
793 |
-
checkbox_group_quality.change(fn=on_filter_model_size_method_change_quality, inputs=[checkbox_group_quality], outputs=data_component_quality)
|
794 |
-
|
795 |
-
# Table i2v
|
796 |
-
with gr.TabItem("VBench-I2V", elem_id="vbench-tab-table", id=4):
|
797 |
-
with gr.Accordion("NOTE", open=False):
|
798 |
-
i2v_note_button = gr.Textbox(
|
799 |
-
value=I2V_CLAIM_TEXT,
|
800 |
-
label="",
|
801 |
-
elem_id="quality-button",
|
802 |
-
lines=3,
|
803 |
-
)
|
804 |
-
with gr.Row():
|
805 |
-
with gr.Column(scale=1.0):
|
806 |
-
# selection for column part:
|
807 |
-
with gr.Row():
|
808 |
-
vbench_team_filter_i2v = gr.Checkbox(
|
809 |
-
label="Sampled by VBench Team (Uncheck to view all submissions)",
|
810 |
-
value=False,
|
811 |
-
interactive=True
|
812 |
-
)
|
813 |
-
vbench_validate_filter_i2v = gr.Checkbox(
|
814 |
-
label="Evaluated by VBench Team (Uncheck to view all submissions)",
|
815 |
-
value=False,
|
816 |
-
interactive=True
|
817 |
-
)
|
818 |
-
checkbox_group_i2v = gr.CheckboxGroup(
|
819 |
-
choices=I2V_TAB,
|
820 |
-
value=I2V_TAB,
|
821 |
-
label="Evaluation Quality Dimension",
|
822 |
-
interactive=True,
|
823 |
-
)
|
824 |
-
|
825 |
-
data_component_i2v = gr.components.Dataframe(
|
826 |
-
value=get_baseline_df_i2v,
|
827 |
-
headers=COLUMN_NAMES_I2V,
|
828 |
-
type="pandas",
|
829 |
-
datatype=I2V_TITILE_TYPE,
|
830 |
-
interactive=False,
|
831 |
-
visible=True,
|
832 |
-
)
|
833 |
-
|
834 |
-
checkbox_group_i2v.change(fn=on_filter_model_size_method_change_i2v, inputs=[checkbox_group_i2v, vbench_team_filter_i2v,vbench_validate_filter_i2v], outputs=data_component_i2v)
|
835 |
-
vbench_team_filter_i2v.change(fn=on_filter_model_size_method_change_i2v, inputs=[checkbox_group_i2v, vbench_team_filter_i2v,vbench_validate_filter_i2v], outputs=data_component_i2v)
|
836 |
-
vbench_validate_filter_i2v.change(fn=on_filter_model_size_method_change_i2v, inputs=[checkbox_group_i2v, vbench_team_filter_i2v,vbench_validate_filter_i2v], outputs=data_component_i2v)
|
837 |
-
|
838 |
-
with gr.TabItem("📊 VBench-Long", elem_id="vbench-tab-table", id=5):
|
839 |
-
with gr.Row():
|
840 |
-
with gr.Accordion("INSTRUCTION", open=False):
|
841 |
-
citation_button = gr.Textbox(
|
842 |
-
value=LONG_CLAIM_TEXT,
|
843 |
-
label="",
|
844 |
-
elem_id="long-ins-button",
|
845 |
-
lines=2,
|
846 |
-
)
|
847 |
-
|
848 |
-
gr.Markdown(
|
849 |
-
TABLE_INTRODUCTION
|
850 |
-
)
|
851 |
-
with gr.Row():
|
852 |
-
with gr.Column(scale=0.2):
|
853 |
-
choosen_q_long = gr.Button("Select Quality Dimensions")
|
854 |
-
choosen_s_long = gr.Button("Select Semantic Dimensions")
|
855 |
-
enable_b_long = gr.Button("Select All")
|
856 |
-
disable_b_long = gr.Button("Deselect All")
|
857 |
-
|
858 |
-
with gr.Column(scale=0.8):
|
859 |
-
with gr.Row():
|
860 |
-
vbench_team_filter_long = gr.Checkbox(
|
861 |
-
label="Sampled by VBench Team (Uncheck to view all submissions)",
|
862 |
-
value=False,
|
863 |
-
interactive=True
|
864 |
-
)
|
865 |
-
vbench_validate_filter_long = gr.Checkbox(
|
866 |
-
label="Evaluated by VBench Team (Uncheck to view all submissions)",
|
867 |
-
value=False,
|
868 |
-
interactive=True
|
869 |
-
)
|
870 |
-
checkbox_group_long = gr.CheckboxGroup(
|
871 |
-
choices=TASK_INFO,
|
872 |
-
value=DEFAULT_INFO,
|
873 |
-
label="Evaluation Dimension",
|
874 |
-
interactive=True,
|
875 |
-
)
|
876 |
-
|
877 |
-
data_component = gr.components.Dataframe(
|
878 |
-
value=get_baseline_df_long,
|
879 |
-
headers=COLUMN_NAMES,
|
880 |
-
type="pandas",
|
881 |
-
datatype=DATA_TITILE_TYPE,
|
882 |
-
interactive=False,
|
883 |
-
visible=True,
|
884 |
-
height=700,
|
885 |
-
)
|
886 |
-
|
887 |
-
choosen_q_long.click(choose_all_quailty, inputs=None, outputs=[checkbox_group_long]).then(fn=on_filter_model_size_method_change_long, inputs=[ checkbox_group_long, vbench_team_filter_long, vbench_validate_filter_long], outputs=data_component)
|
888 |
-
choosen_s_long.click(choose_all_semantic, inputs=None, outputs=[checkbox_group_long]).then(fn=on_filter_model_size_method_change_long, inputs=[ checkbox_group_long, vbench_team_filter_long, vbench_validate_filter_long], outputs=data_component)
|
889 |
-
enable_b_long.click(enable_all, inputs=None, outputs=[checkbox_group_long]).then(fn=on_filter_model_size_method_change_long, inputs=[ checkbox_group_long, vbench_team_filter_long, vbench_validate_filter_long], outputs=data_component)
|
890 |
-
disable_b_long.click(disable_all, inputs=None, outputs=[checkbox_group_long]).then(fn=on_filter_model_size_method_change_long, inputs=[ checkbox_group_long, vbench_team_filter_long, vbench_validate_filter_long], outputs=data_component)
|
891 |
-
checkbox_group_long.change(fn=on_filter_model_size_method_change_long, inputs=[checkbox_group_long, vbench_team_filter_long,vbench_validate_filter_long], outputs=data_component)
|
892 |
-
vbench_team_filter_long.change(fn=on_filter_model_size_method_change_long, inputs=[checkbox_group_long, vbench_team_filter_long,vbench_validate_filter_long], outputs=data_component)
|
893 |
-
vbench_validate_filter_long.change(fn=on_filter_model_size_method_change_long, inputs=[checkbox_group_long, vbench_team_filter_long,vbench_validate_filter_long], outputs=data_component)
|
894 |
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
with gr.TabItem("🚀 [T2V]Submit here! ", elem_id="mvbench-tab-table", id=7):
|
901 |
-
gr.Markdown(LEADERBORAD_INTRODUCTION, elem_classes="markdown-text")
|
902 |
-
|
903 |
-
with gr.Row():
|
904 |
-
gr.Markdown(SUBMIT_INTRODUCTION, elem_classes="markdown-text")
|
905 |
|
906 |
-
|
907 |
-
|
|
|
908 |
|
909 |
-
|
910 |
-
|
911 |
-
with gr.Row():
|
912 |
-
with gr.Column():
|
913 |
-
model_name_textbox = gr.Textbox(
|
914 |
-
label="Model name", placeholder="Required field"
|
915 |
-
)
|
916 |
-
revision_name_textbox = gr.Textbox(
|
917 |
-
label="Revision Model Name(Optional)", placeholder="If you need to update the previous results, please fill in this line"
|
918 |
-
)
|
919 |
-
access_type = gr.Dropdown(["Open Source", "Ready to Open Source", "API", "Close"], label="Please select the way user can access your model. You can update the content by revision_name, or contact the VBench Team.")
|
920 |
|
921 |
-
|
922 |
-
model_link = gr.Textbox(
|
923 |
-
label="Project Page/Paper Link/Github/HuggingFace Repo", placeholder="Required field. If filling in the wrong information, your results may be removed."
|
924 |
-
)
|
925 |
-
team_name = gr.Textbox(
|
926 |
-
label="Your Team Name(If left blank, it will be user upload)", placeholder="User Upload"
|
927 |
-
)
|
928 |
-
contact_email = gr.Textbox(
|
929 |
-
label="E-Mail(Will not be displayed)", placeholder="Required field"
|
930 |
-
)
|
931 |
-
with gr.Row():
|
932 |
-
gr.Markdown("The following is optional and will be synced to [GitHub] (https://github.com/Vchitect/VBench/tree/master/sampled_videos#what-are-the-details-of-the-video-generation-models)", elem_classes="markdown-text")
|
933 |
-
with gr.Row():
|
934 |
-
release_time = gr.Textbox(label="Time of Publish", placeholder="1970-01-01")
|
935 |
-
model_resolution = gr.Textbox(label="resolution", placeholder="Width x Height")
|
936 |
-
model_fps = gr.Textbox(label="model fps", placeholder="FPS(int)")
|
937 |
-
model_frame = gr.Textbox(label="model frame count", placeholder="INT")
|
938 |
-
model_video_length = gr.Textbox(label="model video length", placeholder="float(2.0)")
|
939 |
-
model_checkpoint = gr.Textbox(label="model checkpoint", placeholder="optional")
|
940 |
-
model_commit_id = gr.Textbox(label="github commit id", placeholder='main')
|
941 |
-
model_video_format = gr.Textbox(label="pipeline format", placeholder='mp4')
|
942 |
with gr.Column():
|
943 |
-
|
944 |
-
|
945 |
-
submit_succ_button = gr.Markdown("Submit Success! Please press refresh and return to LeaderBoard!", visible=False)
|
946 |
-
fail_textbox = gr.Markdown('<span style="color:red;">Please ensure that the `Model Name`, `Project Page`, and `Email` are filled in correctly.</span>', elem_classes="markdown-text",visible=False)
|
947 |
-
|
948 |
-
|
949 |
-
submission_result = gr.Markdown()
|
950 |
-
submit_button.click(
|
951 |
-
add_new_eval,
|
952 |
-
inputs = [
|
953 |
-
input_file,
|
954 |
-
model_name_textbox,
|
955 |
-
revision_name_textbox,
|
956 |
-
model_link,
|
957 |
-
team_name,
|
958 |
-
contact_email,
|
959 |
-
release_time,
|
960 |
-
access_type,
|
961 |
-
model_resolution,
|
962 |
-
model_fps,
|
963 |
-
model_frame,
|
964 |
-
model_video_length,
|
965 |
-
model_checkpoint,
|
966 |
-
model_commit_id,
|
967 |
-
model_video_format
|
968 |
-
],
|
969 |
-
outputs=[submit_button, submit_succ_button, fail_textbox]
|
970 |
-
)
|
971 |
-
|
972 |
-
with gr.TabItem("🚀 [I2V]Submit here! ", elem_id="mvbench-i2v-tab-table", id=8):
|
973 |
-
gr.Markdown(LEADERBORAD_INTRODUCTION, elem_classes="markdown-text")
|
974 |
|
975 |
-
|
976 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
977 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
978 |
with gr.Row():
|
979 |
-
gr.Markdown("# ✉️✨ Submit your
|
980 |
|
981 |
-
with gr.Row():
|
982 |
-
gr.Markdown("Here is a required field", elem_classes="markdown-text")
|
983 |
with gr.Row():
|
984 |
with gr.Column():
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
label="
|
|
|
|
|
|
|
990 |
)
|
991 |
-
access_type_i2v = gr.Dropdown(["Open Source", "Ready to Open Source", "API", "Close"], label="Please select the way user can access your model. You can update the content by revision_name, or contact the VBench Team.")
|
992 |
-
|
993 |
|
994 |
with gr.Column():
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
|
|
1000 |
)
|
1001 |
-
|
1002 |
-
|
|
|
|
|
|
|
|
|
1003 |
)
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
submission_result_i2v = gr.Markdown()
|
1023 |
-
submit_button_i2v.click(
|
1024 |
-
add_new_eval_i2v,
|
1025 |
-
inputs = [
|
1026 |
-
input_file_i2v,
|
1027 |
-
model_name_textbox_i2v,
|
1028 |
-
revision_name_textbox_i2v,
|
1029 |
-
model_link_i2v,
|
1030 |
-
team_name_i2v,
|
1031 |
-
contact_email_i2v,
|
1032 |
-
release_time_i2v,
|
1033 |
-
access_type_i2v,
|
1034 |
-
model_resolution_i2v,
|
1035 |
-
model_fps_i2v,
|
1036 |
-
model_frame_i2v,
|
1037 |
-
model_video_length_i2v,
|
1038 |
-
model_checkpoint_i2v,
|
1039 |
-
model_commit_id_i2v,
|
1040 |
-
model_video_format_i2v
|
1041 |
-
],
|
1042 |
-
outputs=[submit_button_i2v, submit_succ_button_i2v, fail_textbox_i2v]
|
1043 |
-
)
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
def refresh_data():
|
1048 |
-
value1 = get_baseline_df()
|
1049 |
-
return value1
|
1050 |
|
1051 |
with gr.Row():
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
|
|
|
|
|
|
|
|
|
|
1055 |
|
1056 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
|
3 |
import pandas as pd
|
4 |
+
from apscheduler.schedulers.background import BackgroundScheduler
|
5 |
+
from huggingface_hub import snapshot_download
|
6 |
+
|
7 |
+
from src.about import (
|
8 |
+
CITATION_BUTTON_LABEL,
|
9 |
+
CITATION_BUTTON_TEXT,
|
10 |
+
EVALUATION_QUEUE_TEXT,
|
11 |
+
INTRODUCTION_TEXT,
|
12 |
+
LLM_BENCHMARKS_TEXT,
|
13 |
+
TITLE,
|
14 |
+
)
|
15 |
+
from src.display.css_html_js import custom_css
|
16 |
+
from src.display.utils import (
|
17 |
+
BENCHMARK_COLS,
|
18 |
+
COLS,
|
19 |
+
EVAL_COLS,
|
20 |
+
EVAL_TYPES,
|
21 |
+
AutoEvalColumn,
|
22 |
+
ModelType,
|
23 |
+
fields,
|
24 |
+
WeightType,
|
25 |
+
Precision
|
26 |
+
)
|
27 |
+
from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, QUEUE_REPO, REPO_ID, RESULTS_REPO, TOKEN
|
28 |
+
from src.populate import get_evaluation_queue_df, get_leaderboard_df
|
29 |
+
from src.submission.submit import add_new_eval
|
30 |
+
|
31 |
+
|
32 |
+
def restart_space():
|
33 |
+
API.restart_space(repo_id=REPO_ID)
|
34 |
+
|
35 |
+
### Space initialisation
|
36 |
+
try:
|
37 |
+
print(EVAL_REQUESTS_PATH)
|
38 |
+
snapshot_download(
|
39 |
+
repo_id=QUEUE_REPO, local_dir=EVAL_REQUESTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30, token=TOKEN
|
40 |
+
)
|
41 |
+
except Exception:
|
42 |
+
restart_space()
|
43 |
+
try:
|
44 |
+
print(EVAL_RESULTS_PATH)
|
45 |
+
snapshot_download(
|
46 |
+
repo_id=RESULTS_REPO, local_dir=EVAL_RESULTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30, token=TOKEN
|
47 |
+
)
|
48 |
+
except Exception:
|
49 |
+
restart_space()
|
50 |
+
|
51 |
+
|
52 |
+
LEADERBOARD_DF = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
|
53 |
+
|
54 |
+
(
|
55 |
+
finished_eval_queue_df,
|
56 |
+
running_eval_queue_df,
|
57 |
+
pending_eval_queue_df,
|
58 |
+
) = get_evaluation_queue_df(EVAL_REQUESTS_PATH, EVAL_COLS)
|
59 |
+
|
60 |
+
def init_leaderboard(dataframe):
|
61 |
+
if dataframe is None or dataframe.empty:
|
62 |
+
raise ValueError("Leaderboard DataFrame is empty or None.")
|
63 |
+
return Leaderboard(
|
64 |
+
value=dataframe,
|
65 |
+
datatype=[c.type for c in fields(AutoEvalColumn)],
|
66 |
+
select_columns=SelectColumns(
|
67 |
+
default_selection=[c.name for c in fields(AutoEvalColumn) if c.displayed_by_default],
|
68 |
+
cant_deselect=[c.name for c in fields(AutoEvalColumn) if c.never_hidden],
|
69 |
+
label="Select Columns to Display:",
|
70 |
+
),
|
71 |
+
search_columns=[AutoEvalColumn.model.name, AutoEvalColumn.license.name],
|
72 |
+
hide_columns=[c.name for c in fields(AutoEvalColumn) if c.hidden],
|
73 |
+
filter_columns=[
|
74 |
+
ColumnFilter(AutoEvalColumn.model_type.name, type="checkboxgroup", label="Model types"),
|
75 |
+
ColumnFilter(AutoEvalColumn.precision.name, type="checkboxgroup", label="Precision"),
|
76 |
+
ColumnFilter(
|
77 |
+
AutoEvalColumn.params.name,
|
78 |
+
type="slider",
|
79 |
+
min=0.01,
|
80 |
+
max=150,
|
81 |
+
label="Select the number of parameters (B)",
|
82 |
+
),
|
83 |
+
ColumnFilter(
|
84 |
+
AutoEvalColumn.still_on_hub.name, type="boolean", label="Deleted/incomplete", default=True
|
85 |
+
),
|
86 |
+
],
|
87 |
+
bool_checkboxgroup_label="Hide models",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
interactive=False,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
+
demo = gr.Blocks(css=custom_css)
|
93 |
+
with demo:
|
94 |
+
gr.HTML(TITLE)
|
95 |
+
gr.Markdown(INTRODUCTION_TEXT)
|
96 |
+
# gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
+
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
99 |
+
with gr.TabItem("🏅 LLM Benchmark", elem_id="llm-benchmark-tab-table", id=0):
|
100 |
+
leaderboard = init_leaderboard(LEADERBOARD_DF)
|
101 |
|
102 |
+
with gr.TabItem("📝 About", elem_id="llm-benchmark-tab-table", id=2):
|
103 |
+
gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
+
with gr.TabItem("🚀 Submit here! ", elem_id="llm-benchmark-tab-table", id=3):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
with gr.Column():
|
107 |
+
with gr.Row():
|
108 |
+
gr.Markdown(EVALUATION_QUEUE_TEXT, elem_classes="markdown-text")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
+
with gr.Column():
|
111 |
+
with gr.Accordion(
|
112 |
+
f"✅ Finished Evaluations ({len(finished_eval_queue_df)})",
|
113 |
+
open=False,
|
114 |
+
):
|
115 |
+
with gr.Row():
|
116 |
+
finished_eval_table = gr.components.Dataframe(
|
117 |
+
value=finished_eval_queue_df,
|
118 |
+
headers=EVAL_COLS,
|
119 |
+
datatype=EVAL_TYPES,
|
120 |
+
row_count=5,
|
121 |
+
)
|
122 |
+
with gr.Accordion(
|
123 |
+
f"🔄 Running Evaluation Queue ({len(running_eval_queue_df)})",
|
124 |
+
open=False,
|
125 |
+
):
|
126 |
+
with gr.Row():
|
127 |
+
running_eval_table = gr.components.Dataframe(
|
128 |
+
value=running_eval_queue_df,
|
129 |
+
headers=EVAL_COLS,
|
130 |
+
datatype=EVAL_TYPES,
|
131 |
+
row_count=5,
|
132 |
+
)
|
133 |
|
134 |
+
with gr.Accordion(
|
135 |
+
f"⏳ Pending Evaluation Queue ({len(pending_eval_queue_df)})",
|
136 |
+
open=False,
|
137 |
+
):
|
138 |
+
with gr.Row():
|
139 |
+
pending_eval_table = gr.components.Dataframe(
|
140 |
+
value=pending_eval_queue_df,
|
141 |
+
headers=EVAL_COLS,
|
142 |
+
datatype=EVAL_TYPES,
|
143 |
+
row_count=5,
|
144 |
+
)
|
145 |
with gr.Row():
|
146 |
+
gr.Markdown("# ✉️✨ Submit your model here!", elem_classes="markdown-text")
|
147 |
|
|
|
|
|
148 |
with gr.Row():
|
149 |
with gr.Column():
|
150 |
+
model_name_textbox = gr.Textbox(label="Model name")
|
151 |
+
revision_name_textbox = gr.Textbox(label="Revision commit", placeholder="main")
|
152 |
+
model_type = gr.Dropdown(
|
153 |
+
choices=[t.to_str(" : ") for t in ModelType if t != ModelType.Unknown],
|
154 |
+
label="Model type",
|
155 |
+
multiselect=False,
|
156 |
+
value=None,
|
157 |
+
interactive=True,
|
158 |
)
|
|
|
|
|
159 |
|
160 |
with gr.Column():
|
161 |
+
precision = gr.Dropdown(
|
162 |
+
choices=[i.value.name for i in Precision if i != Precision.Unknown],
|
163 |
+
label="Precision",
|
164 |
+
multiselect=False,
|
165 |
+
value="float16",
|
166 |
+
interactive=True,
|
167 |
)
|
168 |
+
weight_type = gr.Dropdown(
|
169 |
+
choices=[i.value.name for i in WeightType],
|
170 |
+
label="Weights type",
|
171 |
+
multiselect=False,
|
172 |
+
value="Original",
|
173 |
+
interactive=True,
|
174 |
)
|
175 |
+
base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)")
|
176 |
+
|
177 |
+
submit_button = gr.Button("Submit Eval")
|
178 |
+
submission_result = gr.Markdown()
|
179 |
+
submit_button.click(
|
180 |
+
add_new_eval,
|
181 |
+
[
|
182 |
+
model_name_textbox,
|
183 |
+
base_model_name_textbox,
|
184 |
+
revision_name_textbox,
|
185 |
+
precision,
|
186 |
+
weight_type,
|
187 |
+
model_type,
|
188 |
+
],
|
189 |
+
submission_result,
|
190 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
with gr.Row():
|
193 |
+
with gr.Accordion("📙 Citation", open=False):
|
194 |
+
citation_button = gr.Textbox(
|
195 |
+
value=CITATION_BUTTON_TEXT,
|
196 |
+
label=CITATION_BUTTON_LABEL,
|
197 |
+
lines=20,
|
198 |
+
elem_id="citation-button",
|
199 |
+
show_copy_button=True,
|
200 |
+
)
|
201 |
|
202 |
+
scheduler = BackgroundScheduler()
|
203 |
+
scheduler.add_job(restart_space, "interval", seconds=1800)
|
204 |
+
scheduler.start()
|
205 |
+
demo.queue(default_concurrency_limit=40).launch()
|