Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,7 +46,7 @@ def synthesize(midi_file=None):
|
|
| 46 |
midi = PrettyMIDI(midi_file)
|
| 47 |
midi_synth = midi.synthesize(fs=SAMPLE_RATE)
|
| 48 |
midi_synth = midi_synth.reshape(midi_synth.shape[0], 1)
|
| 49 |
-
return
|
| 50 |
|
| 51 |
def upload(midi_file=None):
|
| 52 |
if isinstance(midi_file, _TemporaryFileWrapper):
|
|
@@ -65,8 +65,8 @@ with gr.Blocks(title="🎹 MIDI-AudioLDM", theme=gr.themes.Base(text_size=gr.the
|
|
| 65 |
with gr.Row():
|
| 66 |
with gr.Column(variant='panel'):
|
| 67 |
midi_synth = gr.Audio(label="synthesized midi")
|
| 68 |
-
upload_button = gr.UploadButton("Upload a MIDI file", file_types=[".mid"])
|
| 69 |
-
midi = gr.File(visible=False
|
| 70 |
upload_button.upload(upload, upload_button, midi)
|
| 71 |
upload_button.upload(synthesize, upload_button, midi_synth)
|
| 72 |
prompt = gr.Textbox(label="prompt", info="Enter a descriptive text prompt to guide the audio generation.")
|
|
|
|
| 46 |
midi = PrettyMIDI(midi_file)
|
| 47 |
midi_synth = midi.synthesize(fs=SAMPLE_RATE)
|
| 48 |
midi_synth = midi_synth.reshape(midi_synth.shape[0], 1)
|
| 49 |
+
return (SAMPLE_RATE, midi_synth)
|
| 50 |
|
| 51 |
def upload(midi_file=None):
|
| 52 |
if isinstance(midi_file, _TemporaryFileWrapper):
|
|
|
|
| 65 |
with gr.Row():
|
| 66 |
with gr.Column(variant='panel'):
|
| 67 |
midi_synth = gr.Audio(label="synthesized midi")
|
| 68 |
+
upload_button = gr.UploadButton("Upload a MIDI file", file_types=[".mid"], value="S00.mid")
|
| 69 |
+
midi = gr.File(visible=False)
|
| 70 |
upload_button.upload(upload, upload_button, midi)
|
| 71 |
upload_button.upload(synthesize, upload_button, midi_synth)
|
| 72 |
prompt = gr.Textbox(label="prompt", info="Enter a descriptive text prompt to guide the audio generation.")
|