Spaces:
Sleeping
Sleeping
Fix sample rate to 44.1kHz and run generation on CPU (GPU decorator only on startup check and load_model)
Browse files
app.py
CHANGED
|
@@ -41,7 +41,6 @@ def load_model(model_name):
|
|
| 41 |
return MODEL_CACHE[model_name]
|
| 42 |
|
| 43 |
|
| 44 |
-
@spaces.GPU(duration=1)
|
| 45 |
def generate_audio(prompt, duration, steps, cfg_scale, seed, model_name):
|
| 46 |
print(f"Generating with {model_name}: prompt='{prompt}', duration={duration}s, steps={steps}, cfg={cfg_scale}, seed={seed}")
|
| 47 |
|
|
@@ -61,7 +60,7 @@ def generate_audio(prompt, duration, steps, cfg_scale, seed, model_name):
|
|
| 61 |
audio = audio.to(torch.float32).clamp(-1, 1).mul(32767).to(torch.int16).cpu()
|
| 62 |
|
| 63 |
output_path = "output.wav"
|
| 64 |
-
torchaudio.save(output_path, audio,
|
| 65 |
print("Generation complete!")
|
| 66 |
return output_path
|
| 67 |
|
|
|
|
| 41 |
return MODEL_CACHE[model_name]
|
| 42 |
|
| 43 |
|
|
|
|
| 44 |
def generate_audio(prompt, duration, steps, cfg_scale, seed, model_name):
|
| 45 |
print(f"Generating with {model_name}: prompt='{prompt}', duration={duration}s, steps={steps}, cfg={cfg_scale}, seed={seed}")
|
| 46 |
|
|
|
|
| 60 |
audio = audio.to(torch.float32).clamp(-1, 1).mul(32767).to(torch.int16).cpu()
|
| 61 |
|
| 62 |
output_path = "output.wav"
|
| 63 |
+
torchaudio.save(output_path, audio, 44100)
|
| 64 |
print("Generation complete!")
|
| 65 |
return output_path
|
| 66 |
|