satvikjain commited on
Commit
0b0d8c2
Β·
verified Β·
1 Parent(s): de6cb5e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +89 -89
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(server_port=7000)
 
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()