Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -35,17 +35,17 @@ from stable_audio_tools.inference.generation import generate_diffusion_cond
|
|
35 |
|
36 |
model, model_config = get_pretrained_model("ford442/stable-audio-open-1.0")
|
37 |
|
|
|
|
|
|
|
|
|
|
|
38 |
# Function to set up, generate, and process the audio
|
39 |
@spaces.GPU(duration=60) # Allocate GPU only when this function is called
|
40 |
def generate_audio(prompt, seconds_total=30, steps=100, cfg_scale=7):
|
41 |
print(f"Prompt received: {prompt}")
|
42 |
print(f"Settings: Duration={seconds_total}s, Steps={steps}, CFG Scale={cfg_scale}")
|
43 |
|
44 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
45 |
-
print(f"Using device: {device}")
|
46 |
-
|
47 |
-
model = model.to(device,torch.bfloat16)
|
48 |
-
|
49 |
# Fetch the Hugging Face token from the environment variable
|
50 |
hf_token = os.getenv('HF_TOKEN')
|
51 |
print(f"Hugging Face token: {hf_token}")
|
|
|
35 |
|
36 |
model, model_config = get_pretrained_model("ford442/stable-audio-open-1.0")
|
37 |
|
38 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
39 |
+
print(f"Using device: {device}")
|
40 |
+
|
41 |
+
model.to(device,torch.bfloat16)
|
42 |
+
|
43 |
# Function to set up, generate, and process the audio
|
44 |
@spaces.GPU(duration=60) # Allocate GPU only when this function is called
|
45 |
def generate_audio(prompt, seconds_total=30, steps=100, cfg_scale=7):
|
46 |
print(f"Prompt received: {prompt}")
|
47 |
print(f"Settings: Duration={seconds_total}s, Steps={steps}, CFG Scale={cfg_scale}")
|
48 |
|
|
|
|
|
|
|
|
|
|
|
49 |
# Fetch the Hugging Face token from the environment variable
|
50 |
hf_token = os.getenv('HF_TOKEN')
|
51 |
print(f"Hugging Face token: {hf_token}")
|