remove old app.py
Browse files- app_old.py +0 -98
app_old.py
DELETED
@@ -1,98 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from utils import *
|
3 |
-
import os
|
4 |
-
|
5 |
-
|
6 |
-
def build_demo():
|
7 |
-
|
8 |
-
|
9 |
-
with gr.Blocks() as demo:
|
10 |
-
state0 = gr.State()
|
11 |
-
state1 = gr.State()
|
12 |
-
with gr.Tab("Song Generation", id=0):
|
13 |
-
gr.Markdown("# π Arena Elo\nFind out who is the π₯ song generation models!")
|
14 |
-
|
15 |
-
with gr.Row():
|
16 |
-
with gr.Column():
|
17 |
-
gr.Markdown("### π Generating now!")
|
18 |
-
with gr.Row():
|
19 |
-
with gr.Column():
|
20 |
-
model_selector_left = gr.Markdown("", visible=True)
|
21 |
-
with gr.Column():
|
22 |
-
model_selector_right = gr.Markdown("", visible=True)
|
23 |
-
|
24 |
-
with gr.Row():
|
25 |
-
with gr.Column():
|
26 |
-
leftheard_btn = gr.Button(
|
27 |
-
value="π© Heard this song before", visible=False, interactive=False
|
28 |
-
)
|
29 |
-
audio_a = gr.Audio(label="Model A", max_length = 100, show_download_button = False)
|
30 |
-
with gr.Column():
|
31 |
-
rightheard_btn = gr.Button(
|
32 |
-
value="π© Heard this song before", visible=False, interactive=False
|
33 |
-
)
|
34 |
-
audio_b = gr.Audio(label="Model B", max_length = 100, show_download_button = False)
|
35 |
-
with gr.Row():
|
36 |
-
leftvote_btn = gr.Button(
|
37 |
-
value="π A is Fake", visible=False, interactive=False
|
38 |
-
)
|
39 |
-
rightvote_btn = gr.Button(
|
40 |
-
value="π B is Fake", visible=False, interactive=False
|
41 |
-
)
|
42 |
-
tie_btn = gr.Button(value="π€ Both are Fake", visible=False, interactive=False)
|
43 |
-
bothbad_btn = gr.Button(
|
44 |
-
value="π Both are Real", visible=False, interactive=False
|
45 |
-
)
|
46 |
-
|
47 |
-
btn_list = [leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, leftheard_btn, rightheard_btn]
|
48 |
-
|
49 |
-
leftvote_btn.click(
|
50 |
-
leftvote_last_response,
|
51 |
-
inputs=[state0, state1],
|
52 |
-
outputs=[leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, leftheard_btn, rightheard_btn, model_selector_left, model_selector_right]
|
53 |
-
)
|
54 |
-
rightvote_btn.click(
|
55 |
-
rightvote_last_response,
|
56 |
-
inputs=[state0, state1],
|
57 |
-
outputs=[leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, leftheard_btn, rightheard_btn, model_selector_left, model_selector_right]
|
58 |
-
)
|
59 |
-
tie_btn.click(
|
60 |
-
tievote_last_response,
|
61 |
-
inputs=[state0, state1],
|
62 |
-
outputs=[leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, leftheard_btn, rightheard_btn, model_selector_left, model_selector_right]
|
63 |
-
)
|
64 |
-
bothbad_btn.click(
|
65 |
-
bothbadvote_last_response,
|
66 |
-
inputs=[state0, state1],
|
67 |
-
outputs=[leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, leftheard_btn, rightheard_btn, model_selector_left, model_selector_right]
|
68 |
-
)
|
69 |
-
|
70 |
-
leftheard_btn.click(
|
71 |
-
leftheard_last_response,
|
72 |
-
inputs=state0,
|
73 |
-
outputs=[leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, leftheard_btn, rightheard_btn, model_selector_left, model_selector_right]
|
74 |
-
)
|
75 |
-
|
76 |
-
rightheard_btn.click(
|
77 |
-
rightheard_last_response,
|
78 |
-
inputs=state1,
|
79 |
-
outputs=[leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, leftheard_btn, rightheard_btn, model_selector_left, model_selector_right]
|
80 |
-
)
|
81 |
-
|
82 |
-
new_round_button = gr.Button("New Round")
|
83 |
-
new_round_button.click(generate_songs, [state0, state1], [state0, audio_a, state1, audio_b, model_selector_left, model_selector_right]).then(
|
84 |
-
enable_buttons_side_by_side,
|
85 |
-
inputs=None,
|
86 |
-
outputs=btn_list
|
87 |
-
)
|
88 |
-
with gr.Tab("Leaderboard", id=1):
|
89 |
-
gr.Markdown("# π Leaderboard work in progress ! π")
|
90 |
-
return demo
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
if __name__ == "__main__":
|
95 |
-
|
96 |
-
# elo_results_file, leaderboard_table_file = load_elo_results(elo_results_dir)
|
97 |
-
demo = build_demo()
|
98 |
-
demo.queue(max_size=20).launch(server_name="0.0.0.0")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|