Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,11 +9,21 @@ import time
|
|
9 |
from fastapi import FastAPI
|
10 |
from fastapi.responses import FileResponse
|
11 |
import asyncio
|
|
|
12 |
|
13 |
|
14 |
# A simple in-memory dictionary to track task status.
|
15 |
# For a production system, you'd use a database or Redis.
|
16 |
tasks = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
def run_video_generation(task_id: str, topic: str, context: str, model: str):
|
19 |
"""
|
|
|
9 |
from fastapi import FastAPI
|
10 |
from fastapi.responses import FileResponse
|
11 |
import asyncio
|
12 |
+
import sys
|
13 |
|
14 |
|
15 |
# A simple in-memory dictionary to track task status.
|
16 |
# For a production system, you'd use a database or Redis.
|
17 |
tasks = {}
|
18 |
+
sys.path.insert(0, os.getcwd())
|
19 |
+
# --- Download Kokoro models if they don't exist ---
|
20 |
+
model_dir = "models"
|
21 |
+
if not os.path.exists(os.path.join(model_dir, "kokoro-v0_19.onnx")):
|
22 |
+
print("Downloading Kokoro TTS models...")
|
23 |
+
os.makedirs(model_dir, exist_ok=True)
|
24 |
+
os.system(f"wget -P {model_dir} https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/kokoro-v0_19.onnx")
|
25 |
+
os.system(f"wget -P {model_dir} https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/voices.bin")
|
26 |
+
print("Model download complete.")
|
27 |
|
28 |
def run_video_generation(task_id: str, topic: str, context: str, model: str):
|
29 |
"""
|