Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
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
|
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(
|