Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ warnings.filterwarnings("ignore")
|
|
8 |
arena = Parse_Prompt()
|
9 |
score = Score()
|
10 |
|
11 |
-
with gr.Blocks(fill_height
|
12 |
with gr.Tab("🪖 Battle Field"):
|
13 |
gr.Markdown('''## ⚔️ LLM: Large Language Mayhem
|
14 |
- Voting should be fair and based on the performance of the models.
|
@@ -20,76 +20,52 @@ with gr.Blocks(fill_height = True) as app:
|
|
20 |
- Don't See Warrior names before voting
|
21 |
''')
|
22 |
with gr.Row():
|
23 |
-
with gr.Accordion("🥷 Warriors", open
|
24 |
-
gr.Dataframe([[model] for model in arena.models], col_count
|
25 |
with gr.Group():
|
26 |
with gr.Row():
|
27 |
with gr.Column():
|
28 |
-
chatbox1 = gr.Chatbot(label
|
29 |
with gr.Column():
|
30 |
-
chatbox2 = gr.Chatbot(label
|
31 |
-
textbox = gr.Textbox(show_label
|
32 |
with gr.Row():
|
33 |
-
with gr.Accordion("🥷 Current Warriors",open
|
34 |
with gr.Row():
|
35 |
-
war1= gr.Textbox(arena.model1, interactive=
|
36 |
-
war2 = gr.Textbox(arena.model2, interactive=
|
37 |
with gr.Row():
|
38 |
-
with gr.Accordion("👆 Vote", open
|
39 |
with gr.Row():
|
40 |
-
vote_a = gr.ClearButton([textbox, chatbox1, chatbox2], value
|
41 |
-
vote_b = gr.ClearButton([textbox, chatbox1, chatbox2], value
|
42 |
-
vote_tie = gr.ClearButton([textbox, chatbox1, chatbox2], value
|
43 |
|
44 |
submit_button = gr.Button("Submit")
|
45 |
with gr.Row():
|
46 |
-
new_round = gr.ClearButton(
|
47 |
-
clear = gr.ClearButton([textbox, chatbox1, chatbox2], value
|
48 |
with gr.Row():
|
49 |
-
with gr.Accordion("🔩 Parameters", open
|
50 |
-
temp_slider = gr.Slider(0,1,value
|
51 |
|
52 |
textbox.submit(
|
53 |
-
fn
|
54 |
-
inputs
|
55 |
-
outputs
|
56 |
-
)
|
57 |
-
textbox.submit(
|
58 |
-
fn = arena.current_model2,
|
59 |
-
outputs = war2
|
60 |
-
)
|
61 |
-
textbox.submit(
|
62 |
-
fn = arena.current_model1,
|
63 |
-
outputs = war1
|
64 |
-
)
|
65 |
-
submit_button.click(
|
66 |
-
fn = arena.gen_output,
|
67 |
-
inputs = [temp_slider, textbox],
|
68 |
-
outputs = [chatbox1, chatbox2]
|
69 |
-
)
|
70 |
-
submit_button.click(
|
71 |
-
fn = arena.current_model1,
|
72 |
-
outputs = war1
|
73 |
-
)
|
74 |
-
submit_button.click(
|
75 |
-
fn = arena.current_model2,
|
76 |
-
outputs = war2
|
77 |
-
)
|
78 |
-
vote_a.click(
|
79 |
-
fn=lambda: score.update(arena.model1, score.df)
|
80 |
-
)
|
81 |
-
vote_b.click(
|
82 |
-
fn = lambda: score.update(arena.model2, score.df)
|
83 |
-
)
|
84 |
-
vote_tie.click(
|
85 |
-
fn = arena.change_models
|
86 |
-
)
|
87 |
-
new_round.click(
|
88 |
-
fn = arena.change_models
|
89 |
-
)
|
90 |
-
clear.click(
|
91 |
-
fn = arena.clear_history
|
92 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
with gr.Tab("💯 Score Board") as data_tab:
|
95 |
gr.Markdown('''## ⚔️ LLM: Large Language Mayhem
|
@@ -97,15 +73,12 @@ with gr.Blocks(fill_height = True) as app:
|
|
97 |
- No cheating or manipulating the outcomes.
|
98 |
- Click on Generate button to Update the 💯 Scoreboard.
|
99 |
''')
|
100 |
-
gr.
|
101 |
-
|
102 |
-
inputs = None,
|
103 |
-
outputs=gr.Dataframe(type="pandas", label="Scoreboard", headers = ["","",""]),
|
104 |
-
live = True,
|
105 |
-
allow_flagging = "never",
|
106 |
-
clear_btn = None
|
107 |
|
|
|
|
|
|
|
108 |
)
|
109 |
-
|
110 |
|
111 |
-
app.launch()
|
|
|
8 |
arena = Parse_Prompt()
|
9 |
score = Score()
|
10 |
|
11 |
+
with gr.Blocks(fill_height=True) as app:
|
12 |
with gr.Tab("🪖 Battle Field"):
|
13 |
gr.Markdown('''## ⚔️ LLM: Large Language Mayhem
|
14 |
- Voting should be fair and based on the performance of the models.
|
|
|
20 |
- Don't See Warrior names before voting
|
21 |
''')
|
22 |
with gr.Row():
|
23 |
+
with gr.Accordion("🥷 Warriors", open=False):
|
24 |
+
gr.Dataframe([[model] for model in arena.models], col_count=1, headers=["🥷"])
|
25 |
with gr.Group():
|
26 |
with gr.Row():
|
27 |
with gr.Column():
|
28 |
+
chatbox1 = gr.Chatbot(label="Warrior A", show_copy_button=True)
|
29 |
with gr.Column():
|
30 |
+
chatbox2 = gr.Chatbot(label="Warrior B", show_copy_button=True)
|
31 |
+
textbox = gr.Textbox(show_label=False, placeholder="👉 Enter your prompt")
|
32 |
with gr.Row():
|
33 |
+
with gr.Accordion("🥷 Current Warriors", open=False):
|
34 |
with gr.Row():
|
35 |
+
war1 = gr.Textbox(arena.model1, interactive=False, show_label=False)
|
36 |
+
war2 = gr.Textbox(arena.model2, interactive=False, show_label=False)
|
37 |
with gr.Row():
|
38 |
+
with gr.Accordion("👆 Vote", open=False):
|
39 |
with gr.Row():
|
40 |
+
vote_a = gr.ClearButton([textbox, chatbox1, chatbox2], value="👈 Warrior A Wins")
|
41 |
+
vote_b = gr.ClearButton([textbox, chatbox1, chatbox2], value="👉 Warrior B Wins")
|
42 |
+
vote_tie = gr.ClearButton([textbox, chatbox1, chatbox2], value="🤝 Both Won")
|
43 |
|
44 |
submit_button = gr.Button("Submit")
|
45 |
with gr.Row():
|
46 |
+
new_round = gr.ClearButton([textbox, chatbox1, chatbox2], value="🎲New Round🎲")
|
47 |
+
clear = gr.ClearButton([textbox, chatbox1, chatbox2], value="🧹 Clear")
|
48 |
with gr.Row():
|
49 |
+
with gr.Accordion("🔩 Parameters", open=False):
|
50 |
+
temp_slider = gr.Slider(0, 1, value=0.7, step=0.1, label="Temprature")
|
51 |
|
52 |
textbox.submit(
|
53 |
+
fn=arena.gen_output,
|
54 |
+
inputs=[temp_slider, textbox],
|
55 |
+
outputs=[chatbox1, chatbox2]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
)
|
57 |
+
textbox.submit(fn=arena.current_model2, outputs=war2)
|
58 |
+
textbox.submit(fn=arena.current_model1, outputs=war1)
|
59 |
+
|
60 |
+
submit_button.click(fn=arena.gen_output, inputs=[temp_slider, textbox], outputs=[chatbox1, chatbox2])
|
61 |
+
submit_button.click(fn=arena.current_model1, outputs=war1)
|
62 |
+
submit_button.click(fn=arena.current_model2, outputs=war2)
|
63 |
+
|
64 |
+
vote_a.click(fn=lambda: score.update(arena.model1, score.df))
|
65 |
+
vote_b.click(fn=lambda: score.update(arena.model2, score.df))
|
66 |
+
vote_tie.click(fn=arena.change_models)
|
67 |
+
new_round.click(fn=arena.change_models)
|
68 |
+
clear.click(fn=arena.clear_history)
|
69 |
|
70 |
with gr.Tab("💯 Score Board") as data_tab:
|
71 |
gr.Markdown('''## ⚔️ LLM: Large Language Mayhem
|
|
|
73 |
- No cheating or manipulating the outcomes.
|
74 |
- Click on Generate button to Update the 💯 Scoreboard.
|
75 |
''')
|
76 |
+
generate_btn = gr.Button("🔄 Generate Scoreboard")
|
77 |
+
scoreboard_df = gr.Dataframe(type="pandas", label="Scoreboard", headers=["", "", ""])
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
+
generate_btn.click(
|
80 |
+
fn=score.df_show,
|
81 |
+
outputs=scoreboard_df
|
82 |
)
|
|
|
83 |
|
84 |
+
app.launch(share=True)
|