Ahsen Khaliq commited on
Commit
6c06937
1 Parent(s): c5c0146

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -262,7 +262,9 @@ inference_model = InferenceModel('/home/user/app/checkpoints/mt3/', 'mt3')
262
 
263
 
264
  def inference(audio):
265
- audio = upload_audio(audio,sample_rate=16000)
 
 
266
 
267
  est_ns = inference_model(audio)
268
 
@@ -270,7 +272,7 @@ def inference(audio):
270
 
271
  return './transcribed.mid'
272
 
273
- title = "Midi-DDSP"
274
  description = "Gradio demo for MIDI-DDSP: Detailed Control of Musical Performance via Hierarchical Modeling. To use it, simply upload your midi file, or click one of the examples to load them. Read more at the links below."
275
 
276
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2112.09312' target='_blank'>MIDI-DDSP: Detailed Control of Musical Performance via Hierarchical Modeling</a> | <a href='https://github.com/magenta/midi-ddsp' target='_blank'>Github Repo</a></p>"
@@ -279,7 +281,7 @@ examples=[['download.wav']]
279
 
280
  gr.Interface(
281
  inference,
282
- gr.inputs.Audio(type="file", label="Input"),
283
  [gr.outputs.File(label="Output")],
284
  title=title,
285
  description=description,
 
262
 
263
 
264
  def inference(audio):
265
+ with open(audio, 'rb') as fd:
266
+ contents = fd.read()
267
+ audio = upload_audio(contents,sample_rate=16000)
268
 
269
  est_ns = inference_model(audio)
270
 
 
272
 
273
  return './transcribed.mid'
274
 
275
+ title = "MT3"
276
  description = "Gradio demo for MIDI-DDSP: Detailed Control of Musical Performance via Hierarchical Modeling. To use it, simply upload your midi file, or click one of the examples to load them. Read more at the links below."
277
 
278
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2112.09312' target='_blank'>MIDI-DDSP: Detailed Control of Musical Performance via Hierarchical Modeling</a> | <a href='https://github.com/magenta/midi-ddsp' target='_blank'>Github Repo</a></p>"
 
281
 
282
  gr.Interface(
283
  inference,
284
+ gr.inputs.Audio(type="filepath", label="Input"),
285
  [gr.outputs.File(label="Output")],
286
  title=title,
287
  description=description,