satvikjain commited on
Commit
f747b35
Β·
verified Β·
1 Parent(s): ddaa7c3

Added warrior names

Browse files
Files changed (2) hide show
  1. app.py +108 -88
  2. 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
- 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
+ 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()