Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import soundfile as sf
|
|
| 4 |
from huggingface_hub import login
|
| 5 |
from diffusers import StableAudioPipeline
|
| 6 |
import gradio as gr
|
|
|
|
| 7 |
|
| 8 |
# Load Hugging Face token securely
|
| 9 |
HUGGINGFACE_TOKEN = os.getenv("HF_TOKEN")
|
|
@@ -28,6 +29,7 @@ pipe = StableAudioPipeline.from_pretrained(
|
|
| 28 |
pipe = pipe.to(device)
|
| 29 |
|
| 30 |
# Function to generate audio
|
|
|
|
| 31 |
def generate_audio(prompt, negative_prompt, duration, diffusion_steps, seed):
|
| 32 |
generator = torch.Generator(device).manual_seed(seed)
|
| 33 |
audio_output = pipe(
|
|
|
|
| 4 |
from huggingface_hub import login
|
| 5 |
from diffusers import StableAudioPipeline
|
| 6 |
import gradio as gr
|
| 7 |
+
import spaces
|
| 8 |
|
| 9 |
# Load Hugging Face token securely
|
| 10 |
HUGGINGFACE_TOKEN = os.getenv("HF_TOKEN")
|
|
|
|
| 29 |
pipe = pipe.to(device)
|
| 30 |
|
| 31 |
# Function to generate audio
|
| 32 |
+
@spaces.GPU
|
| 33 |
def generate_audio(prompt, negative_prompt, duration, diffusion_steps, seed):
|
| 34 |
generator = torch.Generator(device).manual_seed(seed)
|
| 35 |
audio_output = pipe(
|