Spaces:
Running
on
Zero
Running
on
Zero
keshavbhandari
commited on
Commit
•
75c2013
1
Parent(s):
c7f9825
Update max_length in generate_midi function
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ def save_wav(filepath):
|
|
31 |
return wav_filepath
|
32 |
|
33 |
|
34 |
-
def generate_midi(caption, temperature=0.9, max_len=
|
35 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
36 |
artifact_folder = 'artifacts'
|
37 |
|
@@ -60,7 +60,7 @@ def generate_midi(caption, temperature=0.9, max_len=1000):
|
|
60 |
generated_midi = r_tokenizer.decode(output_list)
|
61 |
generated_midi.dump_midi("output.mid")
|
62 |
|
63 |
-
@spaces.GPU(duration=
|
64 |
def gradio_generate(prompt, temperature, max_length):
|
65 |
# Generate midi
|
66 |
generate_midi(prompt, temperature, max_length)
|
@@ -88,7 +88,7 @@ Generate midi music using Text2midi by providing a text prompt.
|
|
88 |
input_text = gr.Textbox(lines=2, label="Prompt")
|
89 |
output_audio = gr.Audio(label="Generated Music", type="filepath")
|
90 |
temperature = gr.Slider(minimum=0.5, maximum=1.2, value=1.0, step=0.1, label="Temperature", interactive=True)
|
91 |
-
max_length = gr.Number(value=
|
92 |
|
93 |
# CSS styling for the Duplicate button
|
94 |
css = '''
|
|
|
31 |
return wav_filepath
|
32 |
|
33 |
|
34 |
+
def generate_midi(caption, temperature=0.9, max_len=500):
|
35 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
36 |
artifact_folder = 'artifacts'
|
37 |
|
|
|
60 |
generated_midi = r_tokenizer.decode(output_list)
|
61 |
generated_midi.dump_midi("output.mid")
|
62 |
|
63 |
+
@spaces.GPU(duration=120)
|
64 |
def gradio_generate(prompt, temperature, max_length):
|
65 |
# Generate midi
|
66 |
generate_midi(prompt, temperature, max_length)
|
|
|
88 |
input_text = gr.Textbox(lines=2, label="Prompt")
|
89 |
output_audio = gr.Audio(label="Generated Music", type="filepath")
|
90 |
temperature = gr.Slider(minimum=0.5, maximum=1.2, value=1.0, step=0.1, label="Temperature", interactive=True)
|
91 |
+
max_length = gr.Number(value=500, label="Max Length", minimum=100, maximum=2000, step=100)
|
92 |
|
93 |
# CSS styling for the Duplicate button
|
94 |
css = '''
|