Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -538,7 +538,7 @@ class AudioAPI:
|
|
| 538 |
input: str = Field(..., description="The text to convert to speech")
|
| 539 |
output_format: OpenaiTTSModels.OutputFormat = Field(default=OpenaiTTSModels.OutputFormat.mp3, description="The audio output format")
|
| 540 |
|
| 541 |
-
@app.post("v2/tts")
|
| 542 |
async def text_to_speech_v2(request: AudioAPI.TTSRequest, api_key: str = Depends(verify_api_key)):
|
| 543 |
"""
|
| 544 |
Convert text to speech using OpenAI's TTS API with real-time audio streaming.
|
|
@@ -570,22 +570,22 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
| 570 |
# CORS middleware setup
|
| 571 |
app.add_middleware(
|
| 572 |
CORSMiddleware,
|
| 573 |
-
allow_origins=["*"],
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
| 589 |
allow_credentials=True,
|
| 590 |
allow_methods=["GET", "POST"],
|
| 591 |
allow_headers=["*"],
|
|
|
|
| 538 |
input: str = Field(..., description="The text to convert to speech")
|
| 539 |
output_format: OpenaiTTSModels.OutputFormat = Field(default=OpenaiTTSModels.OutputFormat.mp3, description="The audio output format")
|
| 540 |
|
| 541 |
+
@app.post("/v2/tts")
|
| 542 |
async def text_to_speech_v2(request: AudioAPI.TTSRequest, api_key: str = Depends(verify_api_key)):
|
| 543 |
"""
|
| 544 |
Convert text to speech using OpenAI's TTS API with real-time audio streaming.
|
|
|
|
| 570 |
# CORS middleware setup
|
| 571 |
app.add_middleware(
|
| 572 |
CORSMiddleware,
|
| 573 |
+
#allow_origins=["*"],
|
| 574 |
+
allow_origins=[
|
| 575 |
+
"http://127.0.0.1:5501/",
|
| 576 |
+
"http://localhost:5501",
|
| 577 |
+
"http://localhost:3000",
|
| 578 |
+
"https://www.elevaticsai.com",
|
| 579 |
+
"https://www.elevatics.cloud",
|
| 580 |
+
"https://www.elevatics.online",
|
| 581 |
+
"https://www.elevatics.ai",
|
| 582 |
+
"https://elevaticsai.com",
|
| 583 |
+
"https://elevatics.cloud",
|
| 584 |
+
"https://elevatics.online",
|
| 585 |
+
"https://elevatics.ai",
|
| 586 |
+
"https://pvanand-specialized-agents.hf.space",
|
| 587 |
+
"https://pvanand-audio-chat.hf.space/"
|
| 588 |
+
],
|
| 589 |
allow_credentials=True,
|
| 590 |
allow_methods=["GET", "POST"],
|
| 591 |
allow_headers=["*"],
|