Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -118,7 +118,7 @@ def display_videos(type, prompt, model_name_1, model_name_2):
|
|
118 |
return video_path1, video_path2
|
119 |
|
120 |
def record_user_feedback_a(model_name1, model_name2, type, prompt):
|
121 |
-
# 0 means model A better, 1 means model B better
|
122 |
hf_api.hf_hub_download(
|
123 |
repo_id = "Vchitect/VBench_human_annotation",
|
124 |
filename = "arena_feedback.csv",
|
@@ -135,10 +135,10 @@ def record_user_feedback_a(model_name1, model_name2, type, prompt):
|
|
135 |
repo_type="dataset",
|
136 |
commit_message="[From VBench Arena] user feedback",
|
137 |
)
|
138 |
-
return gr.update(visible=False),gr.update(visible=False)
|
139 |
|
140 |
def record_user_feedback_b(model_name1, model_name2, type, prompt):
|
141 |
-
# 0 means model A better, 1 means model B better
|
142 |
hf_api.hf_hub_download(
|
143 |
repo_id = "Vchitect/VBench_human_annotation",
|
144 |
filename = "arena_feedback.csv",
|
@@ -155,10 +155,30 @@ def record_user_feedback_b(model_name1, model_name2, type, prompt):
|
|
155 |
repo_type="dataset",
|
156 |
commit_message="[From VBench Arena] user feedback",
|
157 |
)
|
158 |
-
return gr.update(visible=False),gr.update(visible=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
def show_feedback_button():
|
161 |
-
return gr.update(visible=True),gr.update(visible=True)
|
162 |
|
163 |
with gr.Blocks() as interface:
|
164 |
gr.Markdown("# VBench Video Arena")
|
@@ -183,6 +203,7 @@ with gr.Blocks() as interface:
|
|
183 |
video_output_2 = gr.Video(label="Video 2")
|
184 |
with gr.Row():
|
185 |
feed0 = gr.Button("π Model A is better",visible=False)
|
|
|
186 |
feed1 = gr.Button("π Model B is better",visible=False)
|
187 |
type_output.change(fn=update_prompt_options, inputs=[type_output], outputs=[prompt_output])
|
188 |
|
@@ -198,7 +219,7 @@ with gr.Blocks() as interface:
|
|
198 |
outputs=[prompt_output]
|
199 |
).then(
|
200 |
fn= show_feedback_button,
|
201 |
-
outputs=[feed0, feed1]
|
202 |
)
|
203 |
|
204 |
|
@@ -211,12 +232,17 @@ with gr.Blocks() as interface:
|
|
211 |
feed0.click(
|
212 |
fn = record_user_feedback_a,
|
213 |
inputs=[model_name_1_output, model_name_2_output, type_output, prompt_placeholder],
|
214 |
-
outputs=[feed0, feed1]
|
215 |
)
|
216 |
feed1.click(
|
217 |
fn = record_user_feedback_b,
|
218 |
inputs=[model_name_1_output, model_name_2_output, type_output, prompt_placeholder],
|
219 |
-
outputs=[feed0, feed1]
|
|
|
|
|
|
|
|
|
|
|
220 |
)
|
221 |
|
222 |
interface.launch()
|
|
|
118 |
return video_path1, video_path2
|
119 |
|
120 |
def record_user_feedback_a(model_name1, model_name2, type, prompt):
|
121 |
+
# 0 means model A better, 1 means model B better, -1 means tie;
|
122 |
hf_api.hf_hub_download(
|
123 |
repo_id = "Vchitect/VBench_human_annotation",
|
124 |
filename = "arena_feedback.csv",
|
|
|
135 |
repo_type="dataset",
|
136 |
commit_message="[From VBench Arena] user feedback",
|
137 |
)
|
138 |
+
return gr.update(visible=False),gr.update(visible=False),gr.update(visible=False)
|
139 |
|
140 |
def record_user_feedback_b(model_name1, model_name2, type, prompt):
|
141 |
+
# 0 means model A better, 1 means model B better , -1 means tie;
|
142 |
hf_api.hf_hub_download(
|
143 |
repo_id = "Vchitect/VBench_human_annotation",
|
144 |
filename = "arena_feedback.csv",
|
|
|
155 |
repo_type="dataset",
|
156 |
commit_message="[From VBench Arena] user feedback",
|
157 |
)
|
158 |
+
return gr.update(visible=False),gr.update(visible=False),gr.update(visible=False)
|
159 |
+
|
160 |
+
def record_user_feedback_tie(model_name1, model_name2, type, prompt):
|
161 |
+
# 0 means model A better, 1 means model B better , -1 means tie;
|
162 |
+
hf_api.hf_hub_download(
|
163 |
+
repo_id = "Vchitect/VBench_human_annotation",
|
164 |
+
filename = "arena_feedback.csv",
|
165 |
+
repo_type = "dataset",
|
166 |
+
local_dir = './'
|
167 |
+
)
|
168 |
+
with open("arena_feedback.csv",'a') as f:
|
169 |
+
f.write(f"{model_name1}\t{model_name2}\t{type}\t{prompt}\t{-1}\n")
|
170 |
+
hf_api.upload_file(
|
171 |
+
path_or_fileobj="arena_feedback.csv",
|
172 |
+
path_in_repo="arena_feedback.csv",
|
173 |
+
repo_id="Vchitect/VBench_human_annotation",
|
174 |
+
token=hf_token,
|
175 |
+
repo_type="dataset",
|
176 |
+
commit_message="[From VBench Arena] user feedback",
|
177 |
+
)
|
178 |
+
return gr.update(visible=False),gr.update(visible=False),gr.update(visible=False)
|
179 |
|
180 |
def show_feedback_button():
|
181 |
+
return gr.update(visible=True),gr.update(visible=True),gr.update(visible=True)
|
182 |
|
183 |
with gr.Blocks() as interface:
|
184 |
gr.Markdown("# VBench Video Arena")
|
|
|
203 |
video_output_2 = gr.Video(label="Video 2")
|
204 |
with gr.Row():
|
205 |
feed0 = gr.Button("π Model A is better",visible=False)
|
206 |
+
feedt = gr.Button("π« It's hard to say", visible=False)
|
207 |
feed1 = gr.Button("π Model B is better",visible=False)
|
208 |
type_output.change(fn=update_prompt_options, inputs=[type_output], outputs=[prompt_output])
|
209 |
|
|
|
219 |
outputs=[prompt_output]
|
220 |
).then(
|
221 |
fn= show_feedback_button,
|
222 |
+
outputs=[feed0, feedt, feed1]
|
223 |
)
|
224 |
|
225 |
|
|
|
232 |
feed0.click(
|
233 |
fn = record_user_feedback_a,
|
234 |
inputs=[model_name_1_output, model_name_2_output, type_output, prompt_placeholder],
|
235 |
+
outputs=[feed0, feedt, feed1]
|
236 |
)
|
237 |
feed1.click(
|
238 |
fn = record_user_feedback_b,
|
239 |
inputs=[model_name_1_output, model_name_2_output, type_output, prompt_placeholder],
|
240 |
+
outputs=[feed0, feedt, feed1]
|
241 |
+
)
|
242 |
+
feedt.click(
|
243 |
+
fn = record_user_feedback_tie,
|
244 |
+
inputs=[model_name_1_output, model_name_2_output, type_output, prompt_placeholder],
|
245 |
+
outputs=[feed0, feedt, feed1]
|
246 |
)
|
247 |
|
248 |
interface.launch()
|