Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -128,6 +128,9 @@ async def preload_all_assets():
|
|
| 128 |
await asyncio.gather(*tasks)
|
| 129 |
print(f"Preloading completed. {len(download_cache)} files cached on disk.")
|
| 130 |
|
|
|
|
|
|
|
|
|
|
| 131 |
# -----------------------------
|
| 132 |
# TTS Model (XTTS)
|
| 133 |
# -----------------------------
|
|
@@ -441,13 +444,6 @@ async def get_results(task_id: str):
|
|
| 441 |
def root():
|
| 442 |
return {"message": "Welcome! Visit /docs for Swagger UI."}
|
| 443 |
|
| 444 |
-
# -----------------------------
|
| 445 |
-
# Startup preload event
|
| 446 |
-
# -----------------------------
|
| 447 |
-
@app.on_event("startup")
|
| 448 |
-
async def startup_event():
|
| 449 |
-
asyncio.create_task(preload_all_assets())
|
| 450 |
-
|
| 451 |
# -----------------------------
|
| 452 |
# Run app
|
| 453 |
# -----------------------------
|
|
|
|
| 128 |
await asyncio.gather(*tasks)
|
| 129 |
print(f"Preloading completed. {len(download_cache)} files cached on disk.")
|
| 130 |
|
| 131 |
+
import asyncio
|
| 132 |
+
asyncio.run(preload_all_assets())
|
| 133 |
+
|
| 134 |
# -----------------------------
|
| 135 |
# TTS Model (XTTS)
|
| 136 |
# -----------------------------
|
|
|
|
| 444 |
def root():
|
| 445 |
return {"message": "Welcome! Visit /docs for Swagger UI."}
|
| 446 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 447 |
# -----------------------------
|
| 448 |
# Run app
|
| 449 |
# -----------------------------
|