Spaces:
Runtime error
Runtime error
refactor: Delete radio option
Browse files- src/obs_eval_gradio.py +42 -42
- src/prompts.py +3 -3
src/obs_eval_gradio.py
CHANGED
@@ -160,35 +160,35 @@ def show_audio_transcript(video_file, api_key):
|
|
160 |
return transcript
|
161 |
|
162 |
|
163 |
-
def change_audio_rubric(choice):
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
def change_audio_eval(choice):
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
|
193 |
|
194 |
def call_gpt_vision(api_key, rubrics, progress=gr.Progress()) -> list:
|
@@ -380,20 +380,20 @@ def main():
|
|
380 |
gr.Markdown("## 2nd STEP. Set Evaluation Rubric")
|
381 |
with gr.Row():
|
382 |
with gr.Column(scale=1):
|
383 |
-
multimodal_radio = gr.Radio(
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
)
|
389 |
rubric_video_input = gr.Textbox(
|
390 |
-
label="
|
391 |
info="Enter your evaluation rubric here...",
|
392 |
placeholder="Here's what the performer should *SHOW* as follows:\n1. From standing, bend your knees and straighten your arms in front of you.\n2. Place your hands on the floor, shoulder width apart with fingers pointing forward and your chin on your chest.\n3. Rock forward, straighten legs and transfer body weight onto shoulders.\n4. Rock forward on a rounded back placing both feet on the floor.\n5. Stand using arms for balance, without hands touching the floor.",
|
393 |
lines=7
|
394 |
)
|
395 |
rubric_audio_input = gr.Textbox(
|
396 |
-
label="
|
397 |
info="Enter your evaluation rubric here...",
|
398 |
placeholder="Here's what the performer should *SAY* as follows:\n1. From standing, you need to shout 'Start' signal.\n2. Rock forward, you shouldn't make any noise while rolling.\n3. Standing still again, you need to shout 'Finish' signal.",
|
399 |
interactive=True,
|
@@ -404,12 +404,12 @@ def main():
|
|
404 |
with gr.Column(scale=1):
|
405 |
video_output_box = gr.Textbox(
|
406 |
label="Video Batched Snapshots Eval...",
|
407 |
-
lines=
|
408 |
interactive=False
|
409 |
)
|
410 |
audio_output_box = gr.Textbox(
|
411 |
label="Audio Script Eval...",
|
412 |
-
lines=
|
413 |
interactive=False,
|
414 |
visible=True
|
415 |
)
|
@@ -429,11 +429,11 @@ def main():
|
|
429 |
with gr.Column(scale=1):
|
430 |
output_box_fin_fin = gr.Textbox(label="Final Evaluation", lines=10, interactive=True)
|
431 |
|
432 |
-
multimodal_radio.change(fn=change_audio_rubric, inputs=multimodal_radio, outputs=rubric_audio_input)
|
433 |
-
multimodal_radio.change(fn=change_audio_eval, inputs=multimodal_radio, outputs=audio_output_box)
|
434 |
|
435 |
process_button.click(fn=validate_api_key, inputs=api_key_input, outputs=None).success(fn=show_batches, inputs=[video_upload, batch_size, total_batch_percent], outputs=gallery).success(fn=show_audio_transcript, inputs=[video_upload, api_key_input], outputs=transcript_box)
|
436 |
-
if
|
437 |
evaluate_button.click(fn=call_gpt_vision, inputs=[api_key_input, rubric_video_input], outputs=video_output_box).then(fn=call_gpt_audio, inputs=[api_key_input, rubric_audio_input], outputs=audio_output_box).then(get_full_result, None, output_box_fin)
|
438 |
else:
|
439 |
evaluate_button.click(fn=call_gpt_vision, inputs=[api_key_input, rubric_video_input], outputs=video_output_box).then(get_full_result, None, output_box_fin)
|
|
|
160 |
return transcript
|
161 |
|
162 |
|
163 |
+
# def change_audio_rubric(choice):
|
164 |
+
# print(choice)
|
165 |
+
# if choice == "Video only":
|
166 |
+
# return gr.Textbox(
|
167 |
+
# visible=False
|
168 |
+
# )
|
169 |
+
# else:
|
170 |
+
# return gr.Textbox(
|
171 |
+
# label="3. Audio Evaluation Rubric (if needed)",
|
172 |
+
# info="Enter your evaluation rubric here...",
|
173 |
+
# placeholder="<RUBRIC>\nHere's what the performer should *SAY* as follows:\n1. From standing, you need to shout 'Start' signal.\n2. Rock forward, you shouldn't make any noise while rolling.\n3. Standing still again, you need to shout 'Finish' signal.",
|
174 |
+
# lines=7,
|
175 |
+
# interactive=True,
|
176 |
+
# visible=True)
|
177 |
+
|
178 |
+
|
179 |
+
# def change_audio_eval(choice):
|
180 |
+
# print(choice)
|
181 |
+
# if choice == "Video only":
|
182 |
+
# return gr.Textbox(
|
183 |
+
# visible=False,
|
184 |
+
# )
|
185 |
+
# else:
|
186 |
+
# return gr.Textbox(
|
187 |
+
# label="Audio Script Eval...",
|
188 |
+
# lines=10,
|
189 |
+
# interactive=False,
|
190 |
+
# visible=True
|
191 |
+
# )
|
192 |
|
193 |
|
194 |
def call_gpt_vision(api_key, rubrics, progress=gr.Progress()) -> list:
|
|
|
380 |
gr.Markdown("## 2nd STEP. Set Evaluation Rubric")
|
381 |
with gr.Row():
|
382 |
with gr.Column(scale=1):
|
383 |
+
# multimodal_radio = gr.Radio(
|
384 |
+
# label="1. Multimodal Selection",
|
385 |
+
# info="Choose evaluation channel",
|
386 |
+
# value="Video + Audio",
|
387 |
+
# choices=["Video + Audio", "Video only"]
|
388 |
+
# )
|
389 |
rubric_video_input = gr.Textbox(
|
390 |
+
label="Video Evaluation Rubric",
|
391 |
info="Enter your evaluation rubric here...",
|
392 |
placeholder="Here's what the performer should *SHOW* as follows:\n1. From standing, bend your knees and straighten your arms in front of you.\n2. Place your hands on the floor, shoulder width apart with fingers pointing forward and your chin on your chest.\n3. Rock forward, straighten legs and transfer body weight onto shoulders.\n4. Rock forward on a rounded back placing both feet on the floor.\n5. Stand using arms for balance, without hands touching the floor.",
|
393 |
lines=7
|
394 |
)
|
395 |
rubric_audio_input = gr.Textbox(
|
396 |
+
label="Audio Evaluation Rubric (if needed)",
|
397 |
info="Enter your evaluation rubric here...",
|
398 |
placeholder="Here's what the performer should *SAY* as follows:\n1. From standing, you need to shout 'Start' signal.\n2. Rock forward, you shouldn't make any noise while rolling.\n3. Standing still again, you need to shout 'Finish' signal.",
|
399 |
interactive=True,
|
|
|
404 |
with gr.Column(scale=1):
|
405 |
video_output_box = gr.Textbox(
|
406 |
label="Video Batched Snapshots Eval...",
|
407 |
+
lines=8,
|
408 |
interactive=False
|
409 |
)
|
410 |
audio_output_box = gr.Textbox(
|
411 |
label="Audio Script Eval...",
|
412 |
+
lines=8,
|
413 |
interactive=False,
|
414 |
visible=True
|
415 |
)
|
|
|
429 |
with gr.Column(scale=1):
|
430 |
output_box_fin_fin = gr.Textbox(label="Final Evaluation", lines=10, interactive=True)
|
431 |
|
432 |
+
# multimodal_radio.change(fn=change_audio_rubric, inputs=multimodal_radio, outputs=rubric_audio_input)
|
433 |
+
# multimodal_radio.change(fn=change_audio_eval, inputs=multimodal_radio, outputs=audio_output_box)
|
434 |
|
435 |
process_button.click(fn=validate_api_key, inputs=api_key_input, outputs=None).success(fn=show_batches, inputs=[video_upload, batch_size, total_batch_percent], outputs=gallery).success(fn=show_audio_transcript, inputs=[video_upload, api_key_input], outputs=transcript_box)
|
436 |
+
if rubric_audio_input:
|
437 |
evaluate_button.click(fn=call_gpt_vision, inputs=[api_key_input, rubric_video_input], outputs=video_output_box).then(fn=call_gpt_audio, inputs=[api_key_input, rubric_audio_input], outputs=audio_output_box).then(get_full_result, None, output_box_fin)
|
438 |
else:
|
439 |
evaluate_button.click(fn=call_gpt_vision, inputs=[api_key_input, rubric_video_input], outputs=video_output_box).then(get_full_result, None, output_box_fin)
|
src/prompts.py
CHANGED
@@ -7,7 +7,7 @@ Never add your own judgment. Evaluate only in the contents of images themselves.
|
|
7 |
|
8 |
<Evaluate Format>
|
9 |
rubric_1: (original sentence of rubric)
|
10 |
-
score:
|
11 |
reason: (Explain why did you rated it that way)
|
12 |
|
13 |
rubric_2: (original sentence of rubric)
|
@@ -46,7 +46,7 @@ Example:
|
|
46 |
<Video Evaluation>
|
47 |
|
48 |
**RUBRIC_1: (original sentence of rubric)**
|
49 |
-
SCORE:
|
50 |
REASON: (Explain why did you rated it that way)
|
51 |
|
52 |
**RUBRIC_2: (original sentence of rubric)**
|
@@ -56,7 +56,7 @@ REASON: (Explain why did you rated it that way)
|
|
56 |
<Audio Evaluation>
|
57 |
|
58 |
**RUBRIC_1: (original sentence of rubric)**
|
59 |
-
SCORE:
|
60 |
REASON: (Explain why did you rated it that way)
|
61 |
|
62 |
**RUBRIC_2: (original sentence of rubric)**
|
|
|
7 |
|
8 |
<Evaluate Format>
|
9 |
rubric_1: (original sentence of rubric)
|
10 |
+
score: Excellent / Average / Poor / (Undetermined) - evaluate by 3 steps
|
11 |
reason: (Explain why did you rated it that way)
|
12 |
|
13 |
rubric_2: (original sentence of rubric)
|
|
|
46 |
<Video Evaluation>
|
47 |
|
48 |
**RUBRIC_1: (original sentence of rubric)**
|
49 |
+
SCORE: Excellent / Average / Poor / (Undetermined) - evaluate by 3 steps
|
50 |
REASON: (Explain why did you rated it that way)
|
51 |
|
52 |
**RUBRIC_2: (original sentence of rubric)**
|
|
|
56 |
<Audio Evaluation>
|
57 |
|
58 |
**RUBRIC_1: (original sentence of rubric)**
|
59 |
+
SCORE: Excellent / Average / Poor / (Undetermined) - evaluate by 3 steps
|
60 |
REASON: (Explain why did you rated it that way)
|
61 |
|
62 |
**RUBRIC_2: (original sentence of rubric)**
|