Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -14,33 +14,6 @@ os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = "python"
|
|
14 |
|
15 |
DESCRIPTION = """
|
16 |
<h1>🎵 Multitrack Midi Generator 🎶</h1>
|
17 |
-
<h3>AI-driven Music Composer: Creating Music One Instrument at a Time!</h3>
|
18 |
-
<p>This interactive application uses an AI model to generate music sequences based on a chosen genre and various user inputs. The apps constructs the piece instrument by instrument</p>
|
19 |
-
<div style="display: flex; justify-content: space-between;">
|
20 |
-
<div style="width: 45%; margin-right: 5%;">
|
21 |
-
<h2>Features:</h2>
|
22 |
-
<ul>
|
23 |
-
<li>🎼 Select the genre for the music.</li>
|
24 |
-
<li>🌡️ Use the "Temperature" slider to adjust the randomness of the music generated (higher values will produce more random outputs).</li>
|
25 |
-
<li>⏱️ Adjust the "Tempo" slider to change the speed of the music.</li>
|
26 |
-
<li>🎹 Use the buttons to generate a new song from scratch, continue generation with the current settings, remove the last added instrument, regenerate the last added instrument with a new one, or change the tempo of the current song.</li>
|
27 |
-
</ul>
|
28 |
-
</div>
|
29 |
-
<div style="width: 45%; margin-left: 5%;">
|
30 |
-
<h2>Outputs:</h2>
|
31 |
-
<p>The app outputs the following:</p>
|
32 |
-
<ul>
|
33 |
-
<li>🎧 The audio of the generated song.</li>
|
34 |
-
<li>📁 A MIDI file of the song.</li>
|
35 |
-
<li>📊 A plot of the song's sequence.</li>
|
36 |
-
<li>🎸 A list of the generated instruments.</li>
|
37 |
-
<li>📝 The text sequence of the song.</li>
|
38 |
-
</ul>
|
39 |
-
</div>
|
40 |
-
</div>
|
41 |
-
<hr style="margin-top: 2em; margin-bottom: 2em;">
|
42 |
-
<p>This application is built upon the inspiring work of <a href="https://www.linkedin.com/in/dr-tristan-behrens-734967a2" target="_blank">Dr. Tristan Behrens</a></p>
|
43 |
-
<p>Enjoy creating your own music!</p>
|
44 |
"""
|
45 |
|
46 |
|
@@ -52,7 +25,6 @@ demo = gr.Blocks()
|
|
52 |
def run():
|
53 |
with demo:
|
54 |
gr.HTML(DESCRIPTION)
|
55 |
-
gr.DuplicateButton(value="Duplicate Space for private use")
|
56 |
with gr.Row():
|
57 |
with gr.Column():
|
58 |
temp = gr.Slider(
|
@@ -62,12 +34,12 @@ def run():
|
|
62 |
choices=genres, value="POP", label="Select the genre"
|
63 |
)
|
64 |
with gr.Row():
|
65 |
-
btn_from_scratch = gr.Button("
|
66 |
-
btn_continue = gr.Button("
|
67 |
-
btn_remove_last = gr.Button("
|
68 |
-
btn_regenerate_last = gr.Button("
|
69 |
with gr.Column():
|
70 |
-
with gr.
|
71 |
audio_output = gr.Video(show_share_button=True)
|
72 |
midi_file = gr.File()
|
73 |
with gr.Row():
|
@@ -85,18 +57,6 @@ def run():
|
|
85 |
empty_sequence = gr.Text(visible=False)
|
86 |
with gr.Row():
|
87 |
num_tokens = gr.Text(visible=False)
|
88 |
-
btn_from_scratch.click(
|
89 |
-
fn=generate_song,
|
90 |
-
inputs=[genre, temp, empty_sequence, qpm],
|
91 |
-
outputs=[
|
92 |
-
audio_output,
|
93 |
-
midi_file,
|
94 |
-
plot_output,
|
95 |
-
instruments_output,
|
96 |
-
text_sequence,
|
97 |
-
num_tokens,
|
98 |
-
],
|
99 |
-
)
|
100 |
btn_continue.click(
|
101 |
fn=generate_song,
|
102 |
inputs=[genre, temp, text_sequence, qpm],
|
|
|
14 |
|
15 |
DESCRIPTION = """
|
16 |
<h1>🎵 Multitrack Midi Generator 🎶</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
"""
|
18 |
|
19 |
|
|
|
25 |
def run():
|
26 |
with demo:
|
27 |
gr.HTML(DESCRIPTION)
|
|
|
28 |
with gr.Row():
|
29 |
with gr.Column():
|
30 |
temp = gr.Slider(
|
|
|
34 |
choices=genres, value="POP", label="Select the genre"
|
35 |
)
|
36 |
with gr.Row():
|
37 |
+
btn_from_scratch = gr.Button("Start")
|
38 |
+
btn_continue = gr.Button("Continue Generation")
|
39 |
+
btn_remove_last = gr.Button("Remove last instrument")
|
40 |
+
btn_regenerate_last = gr.Button("Regenerate last instrument")
|
41 |
with gr.Column():
|
42 |
+
with gr.Group():
|
43 |
audio_output = gr.Video(show_share_button=True)
|
44 |
midi_file = gr.File()
|
45 |
with gr.Row():
|
|
|
57 |
empty_sequence = gr.Text(visible=False)
|
58 |
with gr.Row():
|
59 |
num_tokens = gr.Text(visible=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
btn_continue.click(
|
61 |
fn=generate_song,
|
62 |
inputs=[genre, temp, text_sequence, qpm],
|