Update app.py
Browse files
app.py
CHANGED
|
@@ -249,7 +249,7 @@ def health():
|
|
| 249 |
|
| 250 |
@app.get("/")
|
| 251 |
def root():
|
| 252 |
-
return PlainTextResponse("ActualTTS (CPU) — use POST /speak or WS /ws/tts")
|
| 253 |
|
| 254 |
@app.get("/file/{name}")
|
| 255 |
def get_file(name: str):
|
|
@@ -335,7 +335,7 @@ async def speak_wav_get(
|
|
| 335 |
length_scale: float = 1.08,
|
| 336 |
noise_scale: float = 0.35,
|
| 337 |
noise_w: float = 0.90,
|
| 338 |
-
background_tasks: BackgroundTasks
|
| 339 |
):
|
| 340 |
"""GET query -> returns audio/wav directly"""
|
| 341 |
text = (text or "").strip()
|
|
@@ -351,7 +351,6 @@ async def speak_wav_get(
|
|
| 351 |
except Exception as e:
|
| 352 |
return JSONResponse({"ok": False, "error": str(e)}, status_code=500)
|
| 353 |
|
| 354 |
-
background_tasks = background_tasks or BackgroundTasks()
|
| 355 |
background_tasks.add_task(_safe_unlink, out_path)
|
| 356 |
return FileResponse(out_path, media_type="audio/wav", filename=out_path.name, background=background_tasks)
|
| 357 |
|
|
|
|
| 249 |
|
| 250 |
@app.get("/")
|
| 251 |
def root():
|
| 252 |
+
return PlainTextResponse("ActualTTS (CPU) — use POST /speak, GET/POST /speak.wav, or WS /ws/tts")
|
| 253 |
|
| 254 |
@app.get("/file/{name}")
|
| 255 |
def get_file(name: str):
|
|
|
|
| 335 |
length_scale: float = 1.08,
|
| 336 |
noise_scale: float = 0.35,
|
| 337 |
noise_w: float = 0.90,
|
| 338 |
+
background_tasks: BackgroundTasks = ...,
|
| 339 |
):
|
| 340 |
"""GET query -> returns audio/wav directly"""
|
| 341 |
text = (text or "").strip()
|
|
|
|
| 351 |
except Exception as e:
|
| 352 |
return JSONResponse({"ok": False, "error": str(e)}, status_code=500)
|
| 353 |
|
|
|
|
| 354 |
background_tasks.add_task(_safe_unlink, out_path)
|
| 355 |
return FileResponse(out_path, media_type="audio/wav", filename=out_path.name, background=background_tasks)
|
| 356 |
|