Spaces:
Sleeping
Sleeping
[fix] remove vote buttons due to too many arg for endpoint
Browse files- tabs/arena_sxs.py +24 -27
tabs/arena_sxs.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
-
from utils.pdf_utils import
|
3 |
from extractors.model_runner import models, run_extract_parallel
|
4 |
-
from leaderboard.vote import vote_for_model, Vote
|
5 |
|
6 |
def update_dropdowns(model_a_choice, model_b_choice):
|
7 |
if model_a_choice == model_b_choice:
|
@@ -28,6 +27,9 @@ def update_vote_button(output):
|
|
28 |
is_active = bool(output)
|
29 |
return [gr.update(interactive=is_active) for _ in range(4)]
|
30 |
|
|
|
|
|
|
|
31 |
def arena_sxs():
|
32 |
with gr.Blocks() as arena_block:
|
33 |
gr.Markdown("# Rules")
|
@@ -58,26 +60,25 @@ def arena_sxs():
|
|
58 |
output_a = gr.Markdown(height=400)
|
59 |
output_b = gr.Markdown(height=400)
|
60 |
|
61 |
-
|
62 |
with gr.Row():
|
63 |
-
extract_button = gr.Button("
|
64 |
|
65 |
-
with gr.Row():
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
|
71 |
-
#
|
72 |
pdf.change(load_pdf, inputs=[pdf], outputs=[pdf_image, page_info, current_page])
|
73 |
pdf.change(fn=update_button, inputs=pdf, outputs=extract_button)
|
74 |
model_a.change(sync_models, inputs=[model_a, model_b], outputs=model_b)
|
75 |
model_a.change(dummy_function_a, inputs=model_a)
|
76 |
model_b.change(dummy_function_b, inputs=model_b)
|
77 |
-
output_a.change(fn=update_vote_button, inputs=output_a, outputs=[vote_model_a_button, vote_model_b_button, vote_tie_button, vote_bad_button])
|
78 |
-
output_b.change(fn=update_vote_button, inputs=output_b, outputs=[vote_model_a_button, vote_model_b_button, vote_tie_button, vote_bad_button])
|
79 |
|
80 |
-
# Button Handlers
|
81 |
prev_button.click(
|
82 |
fn=lambda file_path, page: update_page(file_path, page, -1),
|
83 |
inputs=[pdf, current_page],
|
@@ -93,21 +94,17 @@ def arena_sxs():
|
|
93 |
extract_button.click(
|
94 |
fn=run_extract_parallel,
|
95 |
inputs=[model_a, model_b, pdf],
|
96 |
-
outputs=[output_a, output_b]
|
97 |
-
)
|
98 |
-
|
99 |
-
def clear_outputs():
|
100 |
-
return "", ""
|
101 |
-
|
102 |
-
extract_button.click(
|
103 |
-
fn=clear_outputs,
|
104 |
-
outputs=[output_a, output_b],
|
105 |
)
|
106 |
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
|
|
|
|
|
|
|
|
|
112 |
|
113 |
-
return arena_block
|
|
|
1 |
import gradio as gr
|
2 |
+
from utils.pdf_utils import update_page, load_pdf
|
3 |
from extractors.model_runner import models, run_extract_parallel
|
|
|
4 |
|
5 |
def update_dropdowns(model_a_choice, model_b_choice):
|
6 |
if model_a_choice == model_b_choice:
|
|
|
27 |
is_active = bool(output)
|
28 |
return [gr.update(interactive=is_active) for _ in range(4)]
|
29 |
|
30 |
+
def clear_outputs():
|
31 |
+
return "", ""
|
32 |
+
|
33 |
def arena_sxs():
|
34 |
with gr.Blocks() as arena_block:
|
35 |
gr.Markdown("# Rules")
|
|
|
60 |
output_a = gr.Markdown(height=400)
|
61 |
output_b = gr.Markdown(height=400)
|
62 |
|
|
|
63 |
with gr.Row():
|
64 |
+
extract_button = gr.Button("Parse", interactive=False)
|
65 |
|
66 |
+
# with gr.Row():
|
67 |
+
# vote_model_a_button = gr.Button("π A is better", interactive=False)
|
68 |
+
# vote_model_b_button = gr.Button("π B is better", interactive=False)
|
69 |
+
# vote_tie_button = gr.Button("π€ Tie", interactive=False)
|
70 |
+
# vote_bad_button = gr.Button("π Both are bad", interactive=False)
|
71 |
|
72 |
+
# Handlers
|
73 |
pdf.change(load_pdf, inputs=[pdf], outputs=[pdf_image, page_info, current_page])
|
74 |
pdf.change(fn=update_button, inputs=pdf, outputs=extract_button)
|
75 |
model_a.change(sync_models, inputs=[model_a, model_b], outputs=model_b)
|
76 |
model_a.change(dummy_function_a, inputs=model_a)
|
77 |
model_b.change(dummy_function_b, inputs=model_b)
|
78 |
+
# output_a.change(fn=update_vote_button, inputs=output_a, outputs=[vote_model_a_button, vote_model_b_button, vote_tie_button, vote_bad_button])
|
79 |
+
# output_b.change(fn=update_vote_button, inputs=output_b, outputs=[vote_model_a_button, vote_model_b_button, vote_tie_button, vote_bad_button])
|
80 |
|
81 |
+
# # Button Handlers
|
82 |
prev_button.click(
|
83 |
fn=lambda file_path, page: update_page(file_path, page, -1),
|
84 |
inputs=[pdf, current_page],
|
|
|
94 |
extract_button.click(
|
95 |
fn=run_extract_parallel,
|
96 |
inputs=[model_a, model_b, pdf],
|
97 |
+
outputs=[output_a, output_b]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
)
|
99 |
|
100 |
+
# extract_button.click(
|
101 |
+
# fn=clear_outputs,
|
102 |
+
# outputs=[output_a, output_b]
|
103 |
+
# )
|
104 |
|
105 |
+
# vote_model_a_button.click(fn=lambda model_a, model_b: vote_for_model(model_a, Vote.GOOD, model_b, Vote.NEUTRAL), inputs=[model_a, model_b], outputs=[output_a, output_b])
|
106 |
+
# vote_model_b_button.click(fn=lambda model_a, model_b: vote_for_model(model_a, Vote.NEUTRAL, model_b, Vote.GOOD), inputs=[model_a, model_b], outputs=[output_a, output_b])
|
107 |
+
# vote_tie_button.click(fn=lambda model_a, model_b: vote_for_model(model_a, Vote.NEUTRAL, model_b, Vote.NEUTRAL), inputs=[model_a, model_b], outputs=[output_a, output_b])
|
108 |
+
# vote_bad_button.click(fn=lambda model_a, model_b: vote_for_model(model_a, Vote.BAD, model_b, Vote.BAD), inputs=[model_a, model_b], outputs=[output_a, output_b])
|
109 |
|
110 |
+
return arena_block
|