Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -12,7 +12,7 @@ from fastapi.security import APIKeyHeader
|
|
| 12 |
from fastapi.responses import StreamingResponse
|
| 13 |
from pydantic import BaseModel, Field
|
| 14 |
from openai import OpenAI
|
| 15 |
-
|
| 16 |
# ============================================================================
|
| 17 |
# Configuration and Setup
|
| 18 |
# ============================================================================
|
|
@@ -269,6 +269,27 @@ async def text_to_speech(
|
|
| 269 |
# Main Execution
|
| 270 |
# ============================================================================
|
| 271 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 272 |
if __name__ == "__main__":
|
| 273 |
import uvicorn
|
| 274 |
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
|
|
| 12 |
from fastapi.responses import StreamingResponse
|
| 13 |
from pydantic import BaseModel, Field
|
| 14 |
from openai import OpenAI
|
| 15 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 16 |
# ============================================================================
|
| 17 |
# Configuration and Setup
|
| 18 |
# ============================================================================
|
|
|
|
| 269 |
# Main Execution
|
| 270 |
# ============================================================================
|
| 271 |
|
| 272 |
+
|
| 273 |
+
# CORS middleware setup
|
| 274 |
+
app.add_middleware(
|
| 275 |
+
CORSMiddleware,
|
| 276 |
+
allow_origins=[
|
| 277 |
+
"http://localhost:3000",
|
| 278 |
+
"https://elevaticsai.com",
|
| 279 |
+
"http://elevaticsai.com",
|
| 280 |
+
"https://elevatics.cloud",
|
| 281 |
+
"http://elevatics.cloud",
|
| 282 |
+
"https://elevatics.online",
|
| 283 |
+
"http://elevatics.online",
|
| 284 |
+
"https://elevatics.ai",
|
| 285 |
+
"http://elevatics.ai",
|
| 286 |
+
"https://pvanand-specialized-agents.hf.space"
|
| 287 |
+
],
|
| 288 |
+
allow_credentials=True,
|
| 289 |
+
allow_methods=["GET", "POST"],
|
| 290 |
+
allow_headers=["*"],
|
| 291 |
+
)
|
| 292 |
+
|
| 293 |
if __name__ == "__main__":
|
| 294 |
import uvicorn
|
| 295 |
uvicorn.run(app, host="0.0.0.0", port=8000)
|