lauraibnz commited on
Commit
66ca012
1 Parent(s): 9e21362

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -49,6 +49,8 @@ def synthesize(midi_file=None):
49
  return midi, (SAMPLE_RATE, midi_synth)
50
 
51
  def upload(midi_file=None):
 
 
52
  return midi_file
53
 
54
  with gr.Blocks(title="🎹 MIDI-AudioLDM", theme=gr.themes.Base(text_size=gr.themes.sizes.text_md, font=[gr.themes.GoogleFont("Nunito Sans")])) as demo:
@@ -63,7 +65,7 @@ with gr.Blocks(title="🎹 MIDI-AudioLDM", theme=gr.themes.Base(text_size=gr.the
63
  with gr.Row():
64
  with gr.Column(variant='panel'):
65
  midi_synth = gr.Audio(label="synthesized midi")
66
- upload_button = gr.UploadButton("Upload a MIDI File", file_types=[".mid"])
67
  midi = gr.File(visible=False, value="S00.mid")
68
  upload_button.upload(upload, upload_button, midi)
69
  upload_button.upload(synthesize, upload_button, midi_synth)
 
49
  return midi, (SAMPLE_RATE, midi_synth)
50
 
51
  def upload(midi_file=None):
52
+ if isinstance(midi_file, _TemporaryFileWrapper):
53
+ midi_file = midi_file.name
54
  return midi_file
55
 
56
  with gr.Blocks(title="🎹 MIDI-AudioLDM", theme=gr.themes.Base(text_size=gr.themes.sizes.text_md, font=[gr.themes.GoogleFont("Nunito Sans")])) as demo:
 
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, value="S00.mid")
70
  upload_button.upload(upload, upload_button, midi)
71
  upload_button.upload(synthesize, upload_button, midi_synth)