Update app.py
Browse files
app.py
CHANGED
@@ -1,89 +1,89 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from prompt_parser import Parse_Prompt
|
3 |
-
from scoreboard import Score
|
4 |
-
import warnings
|
5 |
-
|
6 |
-
warnings.filterwarnings("ignore")
|
7 |
-
|
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 |
-
''')
|
20 |
-
with gr.Row():
|
21 |
-
with gr.Accordion("π₯· Warriors", open = False):
|
22 |
-
gr.Dataframe([[model] for model in arena.models], col_count = 1, headers = ["π₯·"])
|
23 |
-
with gr.Group():
|
24 |
-
with gr.Row():
|
25 |
-
with gr.Column():
|
26 |
-
chatbox1 = gr.Chatbot(label = "Warrior A", show_copy_button = True)
|
27 |
-
with gr.Column():
|
28 |
-
chatbox2 = gr.Chatbot(label = "Warrior B", show_copy_button = True)
|
29 |
-
textbox = gr.Textbox(show_label = False, placeholder = "π Enter your prompt")
|
30 |
-
|
31 |
-
with gr.Row():
|
32 |
-
with gr.Accordion("π Vote", open = False):
|
33 |
-
with gr.Row():
|
34 |
-
vote_a = gr.ClearButton([textbox, chatbox1, chatbox2], value = "π Warrior A Wins")
|
35 |
-
vote_b = gr.ClearButton([textbox, chatbox1, chatbox2], value = "π Warrior B Wins")
|
36 |
-
vote_tie = gr.ClearButton([textbox, chatbox1, chatbox2], value = "π€ Both Won")
|
37 |
-
|
38 |
-
submit_button = gr.Button("Submit")
|
39 |
-
with gr.Row():
|
40 |
-
new_round = gr.ClearButton( [textbox, chatbox1, chatbox2], value = "π²New Roundπ²")
|
41 |
-
clear = gr.ClearButton([textbox, chatbox1, chatbox2], value = "π§Ή Clear")
|
42 |
-
with gr.Row():
|
43 |
-
with gr.Accordion("π© Parameters", open = False):
|
44 |
-
temp_slider = gr.Slider(0,1,value = 0.7, step=0.1, label = "Temprature")
|
45 |
-
|
46 |
-
textbox.submit(
|
47 |
-
fn = arena.gen_output,
|
48 |
-
inputs = [temp_slider, textbox],
|
49 |
-
outputs = [chatbox1, chatbox2]
|
50 |
-
)
|
51 |
-
submit_button.click(
|
52 |
-
fn = arena.gen_output,
|
53 |
-
inputs = [temp_slider, textbox],
|
54 |
-
outputs = [chatbox1, chatbox2]
|
55 |
-
)
|
56 |
-
vote_a.click(
|
57 |
-
fn=lambda: score.update(arena.model1, score.df)
|
58 |
-
)
|
59 |
-
vote_b.click(
|
60 |
-
fn = lambda: score.update(arena.model2, score.df)
|
61 |
-
)
|
62 |
-
vote_tie.click(
|
63 |
-
fn = arena.change_models
|
64 |
-
)
|
65 |
-
new_round.click(
|
66 |
-
fn = arena.change_models
|
67 |
-
)
|
68 |
-
clear.click(
|
69 |
-
fn = arena.clear_history
|
70 |
-
)
|
71 |
-
|
72 |
-
with gr.Tab("π― Score Board") as data_tab:
|
73 |
-
gr.Markdown('''## βοΈ LLM: Large Language Mayhem
|
74 |
-
- Voting should be fair and based on the performance of the models.
|
75 |
-
- No cheating or manipulating the outcomes.
|
76 |
-
- Click on Generate button to Update the π― Scoreboard.
|
77 |
-
''')
|
78 |
-
gr.Interface(
|
79 |
-
fn = score.df_show,
|
80 |
-
inputs = None,
|
81 |
-
outputs=gr.Dataframe(type="pandas", label="Scoreboard", headers = ["","",""]),
|
82 |
-
live = True,
|
83 |
-
allow_flagging = "never",
|
84 |
-
clear_btn = None
|
85 |
-
|
86 |
-
)
|
87 |
-
|
88 |
-
|
89 |
-
app.launch(
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from prompt_parser import Parse_Prompt
|
3 |
+
from scoreboard import Score
|
4 |
+
import warnings
|
5 |
+
|
6 |
+
warnings.filterwarnings("ignore")
|
7 |
+
|
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 |
+
''')
|
20 |
+
with gr.Row():
|
21 |
+
with gr.Accordion("π₯· Warriors", open = False):
|
22 |
+
gr.Dataframe([[model] for model in arena.models], col_count = 1, headers = ["π₯·"])
|
23 |
+
with gr.Group():
|
24 |
+
with gr.Row():
|
25 |
+
with gr.Column():
|
26 |
+
chatbox1 = gr.Chatbot(label = "Warrior A", show_copy_button = True)
|
27 |
+
with gr.Column():
|
28 |
+
chatbox2 = gr.Chatbot(label = "Warrior B", show_copy_button = True)
|
29 |
+
textbox = gr.Textbox(show_label = False, placeholder = "π Enter your prompt")
|
30 |
+
|
31 |
+
with gr.Row():
|
32 |
+
with gr.Accordion("π Vote", open = False):
|
33 |
+
with gr.Row():
|
34 |
+
vote_a = gr.ClearButton([textbox, chatbox1, chatbox2], value = "π Warrior A Wins")
|
35 |
+
vote_b = gr.ClearButton([textbox, chatbox1, chatbox2], value = "π Warrior B Wins")
|
36 |
+
vote_tie = gr.ClearButton([textbox, chatbox1, chatbox2], value = "π€ Both Won")
|
37 |
+
|
38 |
+
submit_button = gr.Button("Submit")
|
39 |
+
with gr.Row():
|
40 |
+
new_round = gr.ClearButton( [textbox, chatbox1, chatbox2], value = "π²New Roundπ²")
|
41 |
+
clear = gr.ClearButton([textbox, chatbox1, chatbox2], value = "π§Ή Clear")
|
42 |
+
with gr.Row():
|
43 |
+
with gr.Accordion("π© Parameters", open = False):
|
44 |
+
temp_slider = gr.Slider(0,1,value = 0.7, step=0.1, label = "Temprature")
|
45 |
+
|
46 |
+
textbox.submit(
|
47 |
+
fn = arena.gen_output,
|
48 |
+
inputs = [temp_slider, textbox],
|
49 |
+
outputs = [chatbox1, chatbox2]
|
50 |
+
)
|
51 |
+
submit_button.click(
|
52 |
+
fn = arena.gen_output,
|
53 |
+
inputs = [temp_slider, textbox],
|
54 |
+
outputs = [chatbox1, chatbox2]
|
55 |
+
)
|
56 |
+
vote_a.click(
|
57 |
+
fn=lambda: score.update(arena.model1, score.df)
|
58 |
+
)
|
59 |
+
vote_b.click(
|
60 |
+
fn = lambda: score.update(arena.model2, score.df)
|
61 |
+
)
|
62 |
+
vote_tie.click(
|
63 |
+
fn = arena.change_models
|
64 |
+
)
|
65 |
+
new_round.click(
|
66 |
+
fn = arena.change_models
|
67 |
+
)
|
68 |
+
clear.click(
|
69 |
+
fn = arena.clear_history
|
70 |
+
)
|
71 |
+
|
72 |
+
with gr.Tab("π― Score Board") as data_tab:
|
73 |
+
gr.Markdown('''## βοΈ LLM: Large Language Mayhem
|
74 |
+
- Voting should be fair and based on the performance of the models.
|
75 |
+
- No cheating or manipulating the outcomes.
|
76 |
+
- Click on Generate button to Update the π― Scoreboard.
|
77 |
+
''')
|
78 |
+
gr.Interface(
|
79 |
+
fn = score.df_show,
|
80 |
+
inputs = None,
|
81 |
+
outputs=gr.Dataframe(type="pandas", label="Scoreboard", headers = ["","",""]),
|
82 |
+
live = True,
|
83 |
+
allow_flagging = "never",
|
84 |
+
clear_btn = None
|
85 |
+
|
86 |
+
)
|
87 |
+
|
88 |
+
|
89 |
+
app.launch()
|