lauraibnz commited on
Commit
4af33c5
1 Parent(s): d0713cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  from diffusers import AudioLDMControlNetPipeline, ControlNetModel
3
  import os
4
  from pretty_midi import PrettyMIDI
5
- import tempfile
6
  import torch
7
  import torchaudio
8
 
@@ -22,7 +22,7 @@ generator = torch.Generator(device)
22
 
23
 
24
  def predict(midi_file=None, prompt="", negative_prompt="", audio_length_in_s=5, random_seed=0, controlnet_conditioning_scale=1, num_inference_steps=20, guess_mode=False):
25
- if not os.path.exists(midi_file):
26
  midi_file = midi_file.name
27
  midi = PrettyMIDI(midi_file)
28
  audio = pipe(
 
2
  from diffusers import AudioLDMControlNetPipeline, ControlNetModel
3
  import os
4
  from pretty_midi import PrettyMIDI
5
+ from tempfile import _TemporaryFileWrapper
6
  import torch
7
  import torchaudio
8
 
 
22
 
23
 
24
  def predict(midi_file=None, prompt="", negative_prompt="", audio_length_in_s=5, random_seed=0, controlnet_conditioning_scale=1, num_inference_steps=20, guess_mode=False):
25
+ if isinstance(midi_file, _TemporaryFileWrapper):
26
  midi_file = midi_file.name
27
  midi = PrettyMIDI(midi_file)
28
  audio = pipe(