Spaces:
Runtime error
Runtime error
jonathanagustin
commited on
Commit
•
c094dd2
1
Parent(s):
3eda9dd
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from functools import partial
|
|
3 |
|
4 |
import gradio as gr
|
5 |
import openai
|
6 |
-
|
7 |
|
8 |
def tts(
|
9 |
input_text: str,
|
@@ -53,7 +53,7 @@ def tts(
|
|
53 |
)
|
54 |
# Save the audio content to a temporary file
|
55 |
allowed_formats = ["mp3", "opus", "aac", "flac", "wav"]
|
56 |
-
response_format = response_format.lower()
|
57 |
if response_format not in allowed_formats:
|
58 |
raise ValueError(f"Invalid response format: {response_format}")
|
59 |
file_extension = f".{response_format}"
|
|
|
3 |
|
4 |
import gradio as gr
|
5 |
import openai
|
6 |
+
from werkzeug.utils import secure_filename
|
7 |
|
8 |
def tts(
|
9 |
input_text: str,
|
|
|
53 |
)
|
54 |
# Save the audio content to a temporary file
|
55 |
allowed_formats = ["mp3", "opus", "aac", "flac", "wav"]
|
56 |
+
response_format = secure_filename(response_format.lower())
|
57 |
if response_format not in allowed_formats:
|
58 |
raise ValueError(f"Invalid response format: {response_format}")
|
59 |
file_extension = f".{response_format}"
|