Added warrior names
Browse files- app.py +108 -88
- prompt_parser.py +5 -0
app.py
CHANGED
@@ -1,89 +1,109 @@
|
|
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 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
)
|
59 |
-
|
60 |
-
fn =
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
)
|
68 |
-
|
69 |
-
fn = arena.
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
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 |
+
with gr.Row():
|
31 |
+
with gr.Accordion("Current Warriors",open = False):
|
32 |
+
with gr.Row():
|
33 |
+
war1= gr.Textbox(arena.model1, interactive= False, show_label=False, placeholder="Give a Query and Hit Enter")
|
34 |
+
war2 = gr.Textbox(arena.model2, interactive= False, show_label= False, placeholder="Give a Query and Hit Enter")
|
35 |
+
with gr.Row():
|
36 |
+
with gr.Accordion("π Vote", open = False):
|
37 |
+
with gr.Row():
|
38 |
+
vote_a = gr.ClearButton([textbox, chatbox1, chatbox2], value = "π Warrior A Wins")
|
39 |
+
vote_b = gr.ClearButton([textbox, chatbox1, chatbox2], value = "π Warrior B Wins")
|
40 |
+
vote_tie = gr.ClearButton([textbox, chatbox1, chatbox2], value = "π€ Both Won")
|
41 |
+
|
42 |
+
submit_button = gr.Button("Submit")
|
43 |
+
with gr.Row():
|
44 |
+
new_round = gr.ClearButton( [textbox, chatbox1, chatbox2], value = "π²New Roundπ²")
|
45 |
+
clear = gr.ClearButton([textbox, chatbox1, chatbox2], value = "π§Ή Clear")
|
46 |
+
with gr.Row():
|
47 |
+
with gr.Accordion("π© Parameters", open = False):
|
48 |
+
temp_slider = gr.Slider(0,1,value = 0.7, step=0.1, label = "Temprature")
|
49 |
+
|
50 |
+
textbox.submit(
|
51 |
+
fn = arena.gen_output,
|
52 |
+
inputs = [temp_slider, textbox],
|
53 |
+
outputs = [chatbox1, chatbox2]
|
54 |
+
)
|
55 |
+
textbox.submit(
|
56 |
+
fn = arena.current_model2,
|
57 |
+
outputs = war2
|
58 |
+
)
|
59 |
+
textbox.submit(
|
60 |
+
fn = arena.current_model1,
|
61 |
+
outputs = war1
|
62 |
+
)
|
63 |
+
submit_button.click(
|
64 |
+
fn = arena.gen_output,
|
65 |
+
inputs = [temp_slider, textbox],
|
66 |
+
outputs = [chatbox1, chatbox2]
|
67 |
+
)
|
68 |
+
submit_button.click(
|
69 |
+
fn = arena.current_model1,
|
70 |
+
outputs = war1
|
71 |
+
)
|
72 |
+
submit_button.click(
|
73 |
+
fn = arena.current_model2,
|
74 |
+
outputs = war2
|
75 |
+
)
|
76 |
+
vote_a.click(
|
77 |
+
fn=lambda: score.update(arena.model1, score.df)
|
78 |
+
)
|
79 |
+
vote_b.click(
|
80 |
+
fn = lambda: score.update(arena.model2, score.df)
|
81 |
+
)
|
82 |
+
vote_tie.click(
|
83 |
+
fn = arena.change_models
|
84 |
+
)
|
85 |
+
new_round.click(
|
86 |
+
fn = arena.change_models
|
87 |
+
)
|
88 |
+
clear.click(
|
89 |
+
fn = arena.clear_history
|
90 |
+
)
|
91 |
+
|
92 |
+
with gr.Tab("π― Score Board") as data_tab:
|
93 |
+
gr.Markdown('''## βοΈ LLM: Large Language Mayhem
|
94 |
+
- Voting should be fair and based on the performance of the models.
|
95 |
+
- No cheating or manipulating the outcomes.
|
96 |
+
- Click on Generate button to Update the π― Scoreboard.
|
97 |
+
''')
|
98 |
+
gr.Interface(
|
99 |
+
fn = score.df_show,
|
100 |
+
inputs = None,
|
101 |
+
outputs=gr.Dataframe(type="pandas", label="Scoreboard", headers = ["","",""]),
|
102 |
+
live = True,
|
103 |
+
allow_flagging = "never",
|
104 |
+
clear_btn = None
|
105 |
+
|
106 |
+
)
|
107 |
+
|
108 |
+
|
109 |
app.launch()
|
prompt_parser.py
CHANGED
@@ -21,6 +21,11 @@ class Parse_Prompt(Bot):
|
|
21 |
self.clear_history()
|
22 |
self.change = True
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
def gen_output(self, temp, prompt):
|
25 |
if self.change:
|
26 |
[self.model1, self.model2] = self.model_init()
|
|
|
21 |
self.clear_history()
|
22 |
self.change = True
|
23 |
|
24 |
+
def current_model1(self):
|
25 |
+
return self.model1
|
26 |
+
def current_model2(self):
|
27 |
+
return self.model2
|
28 |
+
|
29 |
def gen_output(self, temp, prompt):
|
30 |
if self.change:
|
31 |
[self.model1, self.model2] = self.model_init()
|