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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +108 -108
app.py CHANGED
@@ -1,109 +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
- 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()
 
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)
34
+ war2 = gr.Textbox(arena.model2, interactive= False, show_label= False)
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()