Spaces:
Building
Building
Update app.py
Browse files
app.py
CHANGED
@@ -83,7 +83,7 @@ def tts_via_api(text):
|
|
83 |
from io import BytesIO
|
84 |
|
85 |
api_key = os.getenv("ELEVENLABS_API_KEY")
|
86 |
-
voice_id = "21m00Tcm4TlvDq8ikWAM" # Rachel
|
87 |
|
88 |
if not api_key:
|
89 |
return None
|
@@ -108,9 +108,10 @@ def tts_via_api(text):
|
|
108 |
response = requests.post(url, headers=headers, json=payload)
|
109 |
|
110 |
if response.status_code == 200:
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
114 |
else:
|
115 |
print("TTS API Error:", response.status_code, response.text)
|
116 |
return None
|
|
|
83 |
from io import BytesIO
|
84 |
|
85 |
api_key = os.getenv("ELEVENLABS_API_KEY")
|
86 |
+
voice_id = "21m00Tcm4TlvDq8ikWAM" # Rachel
|
87 |
|
88 |
if not api_key:
|
89 |
return None
|
|
|
108 |
response = requests.post(url, headers=headers, json=payload)
|
109 |
|
110 |
if response.status_code == 200:
|
111 |
+
output_path = "output.mp3"
|
112 |
+
with open(output_path, "wb") as f:
|
113 |
+
f.write(response.content)
|
114 |
+
return output_path
|
115 |
else:
|
116 |
print("TTS API Error:", response.status_code, response.text)
|
117 |
return None
|