Spaces:
Running
on
Zero
Running
on
Zero
artificialguybr
commited on
Commit
•
00aa3d6
1
Parent(s):
85353b7
Update app.py
Browse files
app.py
CHANGED
@@ -20,9 +20,8 @@ def generate_audio(prompt, seconds_total=30, steps=100, cfg_scale=7):
|
|
20 |
if not hf_token:
|
21 |
raise EnvironmentError("HF_TOKEN environment variable not set")
|
22 |
|
23 |
-
#
|
24 |
-
|
25 |
-
model, model_config = get_pretrained_model("stabilityai/stable-audio-open-1.0")
|
26 |
sample_rate = model_config["sample_rate"]
|
27 |
sample_size = model_config["sample_size"]
|
28 |
|
@@ -53,7 +52,7 @@ def generate_audio(prompt, seconds_total=30, steps=100, cfg_scale=7):
|
|
53 |
|
54 |
# Peak normalize, clip, convert to int16
|
55 |
output = output.to(torch.float32).div(torch.max(torch.abs(output))).clamp(-1, 1).mul(32767).to(torch.int16).cpu()
|
56 |
-
|
57 |
# Generate a unique filename for the output
|
58 |
unique_filename = f"output_{uuid.uuid4().hex}.wav"
|
59 |
# Save to file
|
|
|
20 |
if not hf_token:
|
21 |
raise EnvironmentError("HF_TOKEN environment variable not set")
|
22 |
|
23 |
+
# Download and set up the model
|
24 |
+
model, model_config = get_pretrained_model("stabilityai/stable-audio-open-1.0", TOKEN=hf_token)
|
|
|
25 |
sample_rate = model_config["sample_rate"]
|
26 |
sample_size = model_config["sample_size"]
|
27 |
|
|
|
52 |
|
53 |
# Peak normalize, clip, convert to int16
|
54 |
output = output.to(torch.float32).div(torch.max(torch.abs(output))).clamp(-1, 1).mul(32767).to(torch.int16).cpu()
|
55 |
+
|
56 |
# Generate a unique filename for the output
|
57 |
unique_filename = f"output_{uuid.uuid4().hex}.wav"
|
58 |
# Save to file
|