Fix routing block by changing path to root directory
Browse files
app.py
CHANGED
|
@@ -7,20 +7,19 @@ import soundfile as sf
|
|
| 7 |
|
| 8 |
app = FastAPI(title="Kokoro TTS API Server")
|
| 9 |
|
| 10 |
-
# --- ADD THIS CORS CONFIGURATION BLOCK ---
|
| 11 |
app.add_middleware(
|
| 12 |
CORSMiddleware,
|
| 13 |
-
allow_origins=["*"],
|
| 14 |
allow_credentials=True,
|
| 15 |
allow_methods=["*"],
|
| 16 |
allow_headers=["*"],
|
| 17 |
)
|
| 18 |
-
# -----------------------------------------
|
| 19 |
|
| 20 |
# Initialize the pipeline into memory once at boot
|
| 21 |
pipeline = KPipeline(lang_code='a')
|
| 22 |
|
| 23 |
-
|
|
|
|
| 24 |
async def text_to_speech(payload: dict):
|
| 25 |
text = payload.get("input", "")
|
| 26 |
voice = payload.get("voice", "af_sky")
|
|
|
|
| 7 |
|
| 8 |
app = FastAPI(title="Kokoro TTS API Server")
|
| 9 |
|
|
|
|
| 10 |
app.add_middleware(
|
| 11 |
CORSMiddleware,
|
| 12 |
+
allow_origins=["*"],
|
| 13 |
allow_credentials=True,
|
| 14 |
allow_methods=["*"],
|
| 15 |
allow_headers=["*"],
|
| 16 |
)
|
|
|
|
| 17 |
|
| 18 |
# Initialize the pipeline into memory once at boot
|
| 19 |
pipeline = KPipeline(lang_code='a')
|
| 20 |
|
| 21 |
+
# FIXED: Listening to the clean root path so Hugging Face forwards traffic directly!
|
| 22 |
+
@app.post("/")
|
| 23 |
async def text_to_speech(payload: dict):
|
| 24 |
text = payload.get("input", "")
|
| 25 |
voice = payload.get("voice", "af_sky")
|