Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,104 +8,79 @@ 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 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
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 |
-
|
|
|
|
|
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 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
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
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
gr.
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
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.
|
15 |
+
- No cheating or manipulating the outcomes.
|
16 |
+
- Press π² Random to change the models.
|
17 |
+
- Everything else except the Random button will only clear the screen, model being the same.
|
18 |
+
- Have fun and enjoy the language mayhem!
|
19 |
+
- Warrior names will be visible after your first query (after random also you will have to give a query to see changes)
|
20 |
+
- Don't See Warrior names before voting
|
21 |
+
''')
|
22 |
+
|
23 |
with gr.Row():
|
24 |
+
with gr.Accordion("π₯· Warriors", open=False):
|
25 |
+
gr.Dataframe([[model] for model in arena.models], col_count=1, headers=["π₯·"])
|
26 |
+
|
27 |
with gr.Group():
|
28 |
with gr.Row():
|
29 |
with gr.Column():
|
30 |
+
chatbox1 = gr.Chatbot(label="Warrior A", show_copy_button=True)
|
31 |
with gr.Column():
|
32 |
+
chatbox2 = gr.Chatbot(label="Warrior B", show_copy_button=True)
|
33 |
+
|
34 |
+
textbox = gr.Textbox(show_label=False, placeholder="π Enter your prompt")
|
35 |
+
|
36 |
with gr.Row():
|
37 |
+
with gr.Accordion("π₯· Current Warriors", open=False):
|
38 |
with gr.Row():
|
39 |
+
war1 = gr.Textbox(arena.model1, interactive=False, show_label=False)
|
40 |
+
war2 = gr.Textbox(arena.model2, interactive=False, show_label=False)
|
41 |
+
|
42 |
with gr.Row():
|
43 |
+
with gr.Accordion("π Vote", open=False):
|
44 |
with gr.Row():
|
45 |
+
vote_a = gr.ClearButton([textbox, chatbox1, chatbox2], value="π Warrior A Wins")
|
46 |
+
vote_b = gr.ClearButton([textbox, chatbox1, chatbox2], value="π Warrior B Wins")
|
47 |
+
vote_tie = gr.ClearButton([textbox, chatbox1, chatbox2], value="π€ Both Won")
|
48 |
|
49 |
submit_button = gr.Button("Submit")
|
50 |
+
|
51 |
with gr.Row():
|
52 |
+
new_round = gr.ClearButton([textbox, chatbox1, chatbox2], value="π²New Roundπ²")
|
53 |
+
clear = gr.ClearButton([textbox, chatbox1, chatbox2], value="π§Ή Clear")
|
54 |
+
|
55 |
with gr.Row():
|
56 |
+
with gr.Accordion("π© Parameters", open=False):
|
57 |
+
temp_slider = gr.Slider(0, 1, value=0.7, step=0.1, label="Temperature")
|
58 |
+
|
59 |
+
# Event bindings
|
60 |
+
textbox.submit(fn=arena.gen_output, inputs=[temp_slider, textbox], outputs=[chatbox1, chatbox2])
|
61 |
+
textbox.submit(fn=arena.current_model1, outputs=war1)
|
62 |
+
textbox.submit(fn=arena.current_model2, outputs=war2)
|
63 |
+
|
64 |
+
submit_button.click(fn=arena.gen_output, inputs=[temp_slider, textbox], outputs=[chatbox1, chatbox2])
|
65 |
+
submit_button.click(fn=arena.current_model1, outputs=war1)
|
66 |
+
submit_button.click(fn=arena.current_model2, outputs=war2)
|
67 |
+
|
68 |
+
vote_a.click(fn=lambda: score.update(arena.model1, score.df))
|
69 |
+
vote_b.click(fn=lambda: score.update(arena.model2, score.df))
|
70 |
+
vote_tie.click(fn=arena.change_models)
|
71 |
+
|
72 |
+
new_round.click(fn=arena.change_models)
|
73 |
+
clear.click(fn=arena.clear_history)
|
74 |
+
|
75 |
+
with gr.Tab("π― Score Board"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
gr.Markdown('''## βοΈ LLM: Large Language Mayhem
|
77 |
+
- Voting should be fair and based on the performance of the models.
|
78 |
+
- No cheating or manipulating the outcomes.
|
79 |
+
- Click on Generate button to Update the π― Scoreboard.
|
80 |
+
''')
|
81 |
+
scoreboard = gr.Dataframe(type="pandas", label="Scoreboard", headers=["", "", ""])
|
82 |
+
generate_button = gr.Button("Generate")
|
83 |
+
generate_button.click(fn=score.df_show, outputs=scoreboard)
|
84 |
+
|
85 |
+
# Launch the app with sharing enabled
|
86 |
+
app.launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|