Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -545,13 +545,13 @@ async def text_to_speech_v2(request: AudioAPI.TTSRequest, api_key: str = Depends
|
|
| 545 |
Requires API Key authentication via X-API-Key header.
|
| 546 |
"""
|
| 547 |
try:
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
return StreamingResponse(io.BytesIO(response.content), media_type="audio/mp3")
|
| 556 |
|
| 557 |
except Exception as e:
|
|
|
|
| 545 |
Requires API Key authentication via X-API-Key header.
|
| 546 |
"""
|
| 547 |
try:
|
| 548 |
+
response = openai_client.audio.speech.create(
|
| 549 |
+
model=request.model,
|
| 550 |
+
voice=request.voice,
|
| 551 |
+
input=request.input,
|
| 552 |
+
response_format="mp3" # Always set to MP3
|
| 553 |
+
)
|
| 554 |
+
|
| 555 |
return StreamingResponse(io.BytesIO(response.content), media_type="audio/mp3")
|
| 556 |
|
| 557 |
except Exception as e:
|