Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files45 unmodified lines464748494950515270 unmodified lines12312412512612612712812913013113213313413513613713813914014114214314445 unmodified linesTMP_ROOT = Path("/tmp/stemsplit")TMP_ROOT.mkdir(parents=True, exist_ok=True)
MAX_UPLOAD_BYTES = 80 * 1024 * 1024 # 25 MB — keep CPU jobs short enough to finishMAX_UPLOAD_BYTES = 50 * 1024 * 1024 # 25 MB — keep CPU jobs short enough to finishALLOWED_EXTENSIONS = {".mp3", ".wav", ".m4a", ".flac", ".ogg"}JOB_TTL_SECONDS = 30 * 60 # delete job files/state 30 min after completionSWEEP_INTERVAL_SECONDS = 5 * 6070 unmodified lines
@asynccontextmanagerasync def lifespan(app: FastAPI): load_model() print("===== Application Startup =====") print("Starting background workers...")
worker_task = asyncio.create_task(job_worker()) sweeper_task = asyncio.create_task(job_sweeper())
print("Background workers started.") print("API is ready.")
yield
worker_task.cancel() sweeper_task.cancel()
print("Application shutdown.")
app = FastAPI(title="StemSplit API", lifespan=lifespan)
js/app.py+11-2