Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,11 +51,12 @@ def generate_audio():
|
|
| 51 |
).audios
|
| 52 |
|
| 53 |
# Create an absolute file path in the "static/generated_audio" directory
|
|
|
|
| 54 |
output_filename = f"{prompt.replace(' ', '_')}_output.wav"
|
| 55 |
output_file_path = os.path.join(PUBLIC_DIRECTORY, output_filename)
|
| 56 |
|
| 57 |
# Write the generated audio to the file
|
| 58 |
-
sf.write(output_file_path,
|
| 59 |
|
| 60 |
# Return the absolute URL to the file
|
| 61 |
download_url = f"/download/{output_filename}"
|
|
|
|
| 51 |
).audios
|
| 52 |
|
| 53 |
# Create an absolute file path in the "static/generated_audio" directory
|
| 54 |
+
output_audio = audio_output[0].T.float().cpu().numpy()
|
| 55 |
output_filename = f"{prompt.replace(' ', '_')}_output.wav"
|
| 56 |
output_file_path = os.path.join(PUBLIC_DIRECTORY, output_filename)
|
| 57 |
|
| 58 |
# Write the generated audio to the file
|
| 59 |
+
sf.write(output_file_path, output_audio, pipe.vae.sampling_rate)
|
| 60 |
|
| 61 |
# Return the absolute URL to the file
|
| 62 |
download_url = f"/download/{output_filename}"
|