Spaces:
Running on Zero
Running on Zero
Run loader diagnosis as background job
Browse files419 unmodified lines42042142242342442593 unmodified lines519520521522523524525526527528529530419 unmodified lineswith _BENCH_LOCK:result = _run_cpu_smoke(model_filter)payload = {"status": "complete", "result": result}else:if force:global _BENCH_RESULTS93 unmodified linesexcept Exception as e: return JSONResponse({"error": str(e)}, status_code=502)@fa_app.get("/respite/benchmark/diagnose")def _diagnose(model: str="TinyLlama 1.1B (control)"):try:with _BENCH_LOCK:return JSONResponse(_run_cpu_diagnose(model.strip()))except Exception as e:return JSONResponse({"error": str(e)}, status_code=500)@fa_app.get("/respite/benchmark/smoke")def _smoke(model: str="Gemma 4 E4B", job_id: str=""):419 unmodified lines42042142242342442542642742842993 unmodified lines523524525526527528529530531532533534419 unmodified lineswith _BENCH_LOCK:result = _run_cpu_smoke(model_filter)payload = {"status": "complete", "result": result}elif kind == "diagnose":with _BENCH_LOCK:result = _run_cpu_diagnose(model_filter)payload = {"status": "complete", "result": result}else:if force:global _BENCH_RESULTS93 unmodified linesexcept Exception as e: return JSONResponse({"error": str(e)}, status_code=502)@fa_app.get("/respite/benchmark/diagnose")def _diagnose(model: str="TinyLlama 1.1B (control)", job_id: str=""):if job_id:with _BENCH_JOBS_LOCK:return JSONResponse(_BENCH_JOBS.get(job_id, {"status": "not_found"}))job = _start_benchmark_job("diagnose", model.strip())return JSONResponse({"status": "accepted", "job_id": job, "poll": "/respite/benchmark/diagnose?job_id=" + job}, status_code=202)@fa_app.get("/respite/benchmark/smoke")def _smoke(model: str="Gemma 4 E4B", job_id: str=""):
app.py+10-6