Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Upload 6 files
Browse files
app.py
CHANGED
|
@@ -221,7 +221,7 @@ def register_custom_routes(fastapi_app: FastAPI) -> None:
|
|
| 221 |
return JSONResponse(
|
| 222 |
{
|
| 223 |
"name": "Agentic Space Factory",
|
| 224 |
-
"version": "
|
| 225 |
"bucket_default": settings.bucket_name,
|
| 226 |
"workflows": ["build_from_model_card", "validate_existing_space", "runs_explorer"],
|
| 227 |
"custom_ui_status": "root_custom_ui",
|
|
@@ -288,6 +288,7 @@ def register_custom_routes(fastapi_app: FastAPI) -> None:
|
|
| 288 |
fallback_space_hardware=payload.get("fallback_space_hardware"),
|
| 289 |
allow_fixed_gpu_fallback=bool(payload.get("allow_fixed_gpu_fallback", True)),
|
| 290 |
implementation_mode=payload.get("implementation_mode"),
|
|
|
|
| 291 |
run_id=payload.get("run_id"),
|
| 292 |
bucket_name=bucket_name,
|
| 293 |
)
|
|
@@ -322,16 +323,20 @@ def register_custom_routes(fastapi_app: FastAPI) -> None:
|
|
| 322 |
if not bucket_status.get("ok"):
|
| 323 |
raise HTTPException(status_code=409, detail=f"Run bucket is not ready: {redact(str(bucket_status.get('error') or bucket_status.get('bucket_source') or bucket_name))}. Create the private run bucket before launching validation.")
|
| 324 |
try:
|
| 325 |
-
# Validate JSON early for clearer browser errors.
|
| 326 |
-
json.loads(payload.get("test_args_json") or "[]")
|
| 327 |
-
json.loads(payload.get("test_kwargs_json") or "{}")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
result = launch_validate_existing_space_job(
|
| 329 |
token=ctx["token"],
|
| 330 |
username=ctx["username"],
|
| 331 |
target_space_id=payload.get("target_space_id"),
|
| 332 |
api_name=payload.get("api_name"),
|
| 333 |
-
test_args_json=
|
| 334 |
-
test_kwargs_json=
|
| 335 |
expected_output_type=payload.get("expected_output_type"),
|
| 336 |
live_timeout_seconds=int(payload.get("live_timeout_seconds") or 1800),
|
| 337 |
run_id=payload.get("run_id"),
|
|
|
|
| 221 |
return JSONResponse(
|
| 222 |
{
|
| 223 |
"name": "Agentic Space Factory",
|
| 224 |
+
"version": "v91-pi-model-detection-from-published-traces",
|
| 225 |
"bucket_default": settings.bucket_name,
|
| 226 |
"workflows": ["build_from_model_card", "validate_existing_space", "runs_explorer"],
|
| 227 |
"custom_ui_status": "root_custom_ui",
|
|
|
|
| 288 |
fallback_space_hardware=payload.get("fallback_space_hardware"),
|
| 289 |
allow_fixed_gpu_fallback=bool(payload.get("allow_fixed_gpu_fallback", True)),
|
| 290 |
implementation_mode=payload.get("implementation_mode"),
|
| 291 |
+
expected_output_type=payload.get("expected_output_type"),
|
| 292 |
run_id=payload.get("run_id"),
|
| 293 |
bucket_name=bucket_name,
|
| 294 |
)
|
|
|
|
| 323 |
if not bucket_status.get("ok"):
|
| 324 |
raise HTTPException(status_code=409, detail=f"Run bucket is not ready: {redact(str(bucket_status.get('error') or bucket_status.get('bucket_source') or bucket_name))}. Create the private run bucket before launching validation.")
|
| 325 |
try:
|
| 326 |
+
# Validate and normalize JSON early for clearer browser errors.
|
| 327 |
+
test_args = json.loads(payload.get("test_args_json") or "[]")
|
| 328 |
+
test_kwargs = json.loads(payload.get("test_kwargs_json") or "{}")
|
| 329 |
+
if not isinstance(test_args, list):
|
| 330 |
+
raise ValueError("test_args_json must be a JSON array; it is passed as positional args to gradio_client.predict().")
|
| 331 |
+
if not isinstance(test_kwargs, dict):
|
| 332 |
+
raise ValueError("test_kwargs_json must be a JSON object; it is passed as keyword args to gradio_client.predict().")
|
| 333 |
result = launch_validate_existing_space_job(
|
| 334 |
token=ctx["token"],
|
| 335 |
username=ctx["username"],
|
| 336 |
target_space_id=payload.get("target_space_id"),
|
| 337 |
api_name=payload.get("api_name"),
|
| 338 |
+
test_args_json=json.dumps(test_args, ensure_ascii=False),
|
| 339 |
+
test_kwargs_json=json.dumps(test_kwargs, ensure_ascii=False),
|
| 340 |
expected_output_type=payload.get("expected_output_type"),
|
| 341 |
live_timeout_seconds=int(payload.get("live_timeout_seconds") or 1800),
|
| 342 |
run_id=payload.get("run_id"),
|