Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -54,7 +54,12 @@ with open("videos_by_dimension.json") as f:
|
|
54 |
types = ['appearance_style', 'color', 'temporal_style', 'spatial_relationship', 'temporal_flickering', 'scene', 'multiple_objects', 'object_class', 'human_action', 'overall_consistency', 'subject_consistency']
|
55 |
|
56 |
def get_video_path_local(model_name, type, prompt):
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
58 |
try:
|
59 |
return hf_api.hf_hub_download(
|
60 |
repo_id = repo_id,
|
@@ -108,14 +113,28 @@ def display_videos(type, prompt, model_name_1, model_name_2):
|
|
108 |
video_path2 = get_video_path_local(model_name_2, type, prompt)
|
109 |
return video_path1, video_path2
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
with gr.Blocks() as interface:
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
type_output = gr.Dropdown(label="Type", choices=types, value=types[0])
|
114 |
prompt_output = gr.Dropdown(label="Prompt", choices=dimension[types[0]], value=dimension[types[0]][0])
|
115 |
prompt_placeholder = gr.State()
|
116 |
with gr.Row():
|
117 |
random_button = gr.Button("π² Random 2 videos")
|
118 |
-
display_button = gr.Button("
|
119 |
|
120 |
with gr.Row():
|
121 |
with gr.Column():
|
@@ -124,9 +143,11 @@ with gr.Blocks() as interface:
|
|
124 |
with gr.Column():
|
125 |
model_name_2_output = gr.Dropdown(label="Model Name 2", choices=model_names, value=model_names[1])
|
126 |
video_output_2 = gr.Video(label="Video 2")
|
127 |
-
|
|
|
|
|
128 |
type_output.change(fn=update_prompt_options, inputs=[type_output], outputs=[prompt_output])
|
129 |
-
|
130 |
|
131 |
random_button.click(
|
132 |
fn=get_random_video,
|
@@ -144,4 +165,13 @@ with gr.Blocks() as interface:
|
|
144 |
outputs=[video_output_1, video_output_2]
|
145 |
)
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
interface.launch()
|
|
|
54 |
types = ['appearance_style', 'color', 'temporal_style', 'spatial_relationship', 'temporal_flickering', 'scene', 'multiple_objects', 'object_class', 'human_action', 'overall_consistency', 'subject_consistency']
|
55 |
|
56 |
def get_video_path_local(model_name, type, prompt):
|
57 |
+
if 'Show-1' in model_name:
|
58 |
+
video_path_subfolder = os.path.join(model_name, type, 'super2')
|
59 |
+
elif 'videocrafter-1' in model_name:
|
60 |
+
video_path_subfolder = os.path.join(model_name, type, '1024x576')
|
61 |
+
else:
|
62 |
+
video_path_subfolder = os.path.join(model_name, type)
|
63 |
try:
|
64 |
return hf_api.hf_hub_download(
|
65 |
repo_id = repo_id,
|
|
|
113 |
video_path2 = get_video_path_local(model_name_2, type, prompt)
|
114 |
return video_path1, video_path2
|
115 |
|
116 |
+
def record_user_feedback_a(model_name1, model_name2, type, prompt):
|
117 |
+
# 0 means model A better, 1 means model B better
|
118 |
+
with open("user_feedback.csv",'a') as f:
|
119 |
+
f.write(f"{model_name1}\t{model_name2}\t{type}\t{prompt}\t{0}\n")
|
120 |
+
def record_user_feedback_b(model_name1, model_name2, type, prompt):
|
121 |
+
# 0 means model A better, 1 means model B better
|
122 |
+
with open("user_feedback.csv",'a') as f:
|
123 |
+
f.write(f"{model_name1}\t{model_name2}\t{type}\t{prompt}\t{1}\n")
|
124 |
|
125 |
with gr.Blocks() as interface:
|
126 |
+
gr.Markdown("# VBench Video Arena")
|
127 |
+
gr.Markdown("""
|
128 |
+
**Random 2 videos** for randomly picking two models to compare random with the same dimension and prompt
|
129 |
+
**Play Selection** is used for the user to select the model, dimension, prompt in the drop-down box, and display them
|
130 |
+
If you are interested, you can also leave your comments.""")
|
131 |
+
|
132 |
type_output = gr.Dropdown(label="Type", choices=types, value=types[0])
|
133 |
prompt_output = gr.Dropdown(label="Prompt", choices=dimension[types[0]], value=dimension[types[0]][0])
|
134 |
prompt_placeholder = gr.State()
|
135 |
with gr.Row():
|
136 |
random_button = gr.Button("π² Random 2 videos")
|
137 |
+
display_button = gr.Button("π Play Selection")
|
138 |
|
139 |
with gr.Row():
|
140 |
with gr.Column():
|
|
|
143 |
with gr.Column():
|
144 |
model_name_2_output = gr.Dropdown(label="Model Name 2", choices=model_names, value=model_names[1])
|
145 |
video_output_2 = gr.Video(label="Video 2")
|
146 |
+
with gr.Row():
|
147 |
+
feed0 = gr.Button("π Model A is better")
|
148 |
+
feed1 = gr.Button("π Model B is better")
|
149 |
type_output.change(fn=update_prompt_options, inputs=[type_output], outputs=[prompt_output])
|
150 |
+
|
151 |
|
152 |
random_button.click(
|
153 |
fn=get_random_video,
|
|
|
165 |
outputs=[video_output_1, video_output_2]
|
166 |
)
|
167 |
|
168 |
+
feed0.click(
|
169 |
+
fn = record_user_feedback_a,
|
170 |
+
inputs=[model_name_1_output, model_name_2_output, type_output, prompt_placeholder]
|
171 |
+
)
|
172 |
+
feed1.click(
|
173 |
+
fn = record_user_feedback_b,
|
174 |
+
inputs=[model_name_1_output, model_name_2_output, type_output, prompt_placeholder]
|
175 |
+
)
|
176 |
+
|
177 |
interface.launch()
|