Spaces:
Runtime error
Runtime error
jonathanagustin
commited on
Commit
•
626ed08
1
Parent(s):
286fb71
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -52,6 +52,9 @@ def tts(
|
|
52 |
speed=speed,
|
53 |
)
|
54 |
# Save the audio content to a temporary file
|
|
|
|
|
|
|
55 |
file_extension = f".{response_format}"
|
56 |
with tempfile.NamedTemporaryFile(
|
57 |
suffix=file_extension, delete=False, mode="wb"
|
|
|
52 |
speed=speed,
|
53 |
)
|
54 |
# Save the audio content to a temporary file
|
55 |
+
allowed_formats = ["mp3", "opus", "aac", "flac", "wav"]
|
56 |
+
if response_format not in allowed_formats:
|
57 |
+
raise ValueError(f"Invalid response format: {response_format}")
|
58 |
file_extension = f".{response_format}"
|
59 |
with tempfile.NamedTemporaryFile(
|
60 |
suffix=file_extension, delete=False, mode="wb"
|