Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Upload 4 files
Browse files
README.md
CHANGED
|
@@ -133,4 +133,4 @@ See `CHANGELOG_V194.md` for the Model Pre-scan Decision Card UI pass.
|
|
| 133 |
See `CHANGELOG_V195.md` for the Runtime CSS Cleanup with Legacy Safety Net pass.
|
| 134 |
|
| 135 |
|
| 136 |
-
Current release: Agentic Space Factory v198.23.
|
|
|
|
| 133 |
See `CHANGELOG_V195.md` for the Runtime CSS Cleanup with Legacy Safety Net pass.
|
| 134 |
|
| 135 |
|
| 136 |
+
Current release: Agentic Space Factory v198.23.4.
|
app.py
CHANGED
|
@@ -8,7 +8,7 @@ from typing import Any
|
|
| 8 |
|
| 9 |
import gradio as gr
|
| 10 |
from fastapi import FastAPI, HTTPException, Request
|
| 11 |
-
from fastapi.responses import HTMLResponse, JSONResponse, FileResponse
|
| 12 |
from huggingface_hub import HfApi, attach_huggingface_oauth
|
| 13 |
|
| 14 |
from src.bucket import RunPaths, check_user_bucket, create_user_bucket, delete_run_folder, read_run_bundle, list_recent_runs, write_json, write_launch_metadata
|
|
@@ -407,13 +407,6 @@ def register_custom_routes(fastapi_app: FastAPI) -> None:
|
|
| 407 |
raise HTTPException(status_code=404, detail="Asset not found")
|
| 408 |
return FileResponse(path)
|
| 409 |
|
| 410 |
-
@fastapi_app.get("/login/huggingface")
|
| 411 |
-
async def login_redirect(): # type: ignore[no-untyped-def]
|
| 412 |
-
return RedirectResponse("/oauth/huggingface/login?_target_url=/")
|
| 413 |
-
|
| 414 |
-
@fastapi_app.get("/logout")
|
| 415 |
-
async def logout_redirect(): # type: ignore[no-untyped-def]
|
| 416 |
-
return RedirectResponse("/oauth/huggingface/logout?_target_url=/")
|
| 417 |
|
| 418 |
@fastapi_app.get("/api/app-info")
|
| 419 |
async def api_app_info(request: Request): # type: ignore[no-untyped-def]
|
|
@@ -431,8 +424,8 @@ def register_custom_routes(fastapi_app: FastAPI) -> None:
|
|
| 431 |
"workflows": ["build_from_model_card", "validate_existing_space", "runs_explorer"],
|
| 432 |
"custom_ui_status": "root_custom_ui",
|
| 433 |
"user": {"username": ctx["username"], "missing_scopes": ctx.get("missing_scopes", []), "warnings": ctx.get("warnings", []), "auth_lifetime": ctx.get("auth_lifetime")} if ctx else None,
|
| 434 |
-
"login_url": "/oauth/huggingface/login
|
| 435 |
-
"logout_url": "/oauth/huggingface/logout
|
| 436 |
"anonymous_eval": public_eval_config(ctx["username"] if ctx else None),
|
| 437 |
}
|
| 438 |
)
|
|
@@ -456,8 +449,8 @@ def register_custom_routes(fastapi_app: FastAPI) -> None:
|
|
| 456 |
"auth_lifetime": ctx.get("auth_lifetime"),
|
| 457 |
"anonymous_eval": public_eval_config(ctx["username"] if ctx else None),
|
| 458 |
"expires_at": ctx.get("expires_at"),
|
| 459 |
-
"login_url": "/oauth/huggingface/login
|
| 460 |
-
"logout_url": "/oauth/huggingface/logout
|
| 461 |
}
|
| 462 |
)
|
| 463 |
|
|
@@ -545,9 +538,8 @@ def register_custom_routes(fastapi_app: FastAPI) -> None:
|
|
| 545 |
"authenticated": False,
|
| 546 |
"reason": exc.detail,
|
| 547 |
"oauth_env": env_status,
|
| 548 |
-
"login_url": "/oauth/huggingface/login
|
| 549 |
-
"logout_url": "/oauth/huggingface/logout
|
| 550 |
-
"embedded_login_advice": "Open sign-in in a new tab/window when the Space is embedded in an iframe.",
|
| 551 |
}
|
| 552 |
)
|
| 553 |
return JSONResponse(
|
|
@@ -556,8 +548,8 @@ def register_custom_routes(fastapi_app: FastAPI) -> None:
|
|
| 556 |
"user": public_oauth_context(ctx),
|
| 557 |
"token_identity": verify_token_identity(ctx),
|
| 558 |
"oauth_env": env_status,
|
| 559 |
-
"login_url": "/oauth/huggingface/login
|
| 560 |
-
"logout_url": "/oauth/huggingface/logout
|
| 561 |
}
|
| 562 |
)
|
| 563 |
|
|
|
|
| 8 |
|
| 9 |
import gradio as gr
|
| 10 |
from fastapi import FastAPI, HTTPException, Request
|
| 11 |
+
from fastapi.responses import HTMLResponse, JSONResponse, FileResponse
|
| 12 |
from huggingface_hub import HfApi, attach_huggingface_oauth
|
| 13 |
|
| 14 |
from src.bucket import RunPaths, check_user_bucket, create_user_bucket, delete_run_folder, read_run_bundle, list_recent_runs, write_json, write_launch_metadata
|
|
|
|
| 407 |
raise HTTPException(status_code=404, detail="Asset not found")
|
| 408 |
return FileResponse(path)
|
| 409 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 410 |
|
| 411 |
@fastapi_app.get("/api/app-info")
|
| 412 |
async def api_app_info(request: Request): # type: ignore[no-untyped-def]
|
|
|
|
| 424 |
"workflows": ["build_from_model_card", "validate_existing_space", "runs_explorer"],
|
| 425 |
"custom_ui_status": "root_custom_ui",
|
| 426 |
"user": {"username": ctx["username"], "missing_scopes": ctx.get("missing_scopes", []), "warnings": ctx.get("warnings", []), "auth_lifetime": ctx.get("auth_lifetime")} if ctx else None,
|
| 427 |
+
"login_url": "/oauth/huggingface/login",
|
| 428 |
+
"logout_url": "/oauth/huggingface/logout",
|
| 429 |
"anonymous_eval": public_eval_config(ctx["username"] if ctx else None),
|
| 430 |
}
|
| 431 |
)
|
|
|
|
| 449 |
"auth_lifetime": ctx.get("auth_lifetime"),
|
| 450 |
"anonymous_eval": public_eval_config(ctx["username"] if ctx else None),
|
| 451 |
"expires_at": ctx.get("expires_at"),
|
| 452 |
+
"login_url": "/oauth/huggingface/login",
|
| 453 |
+
"logout_url": "/oauth/huggingface/logout",
|
| 454 |
}
|
| 455 |
)
|
| 456 |
|
|
|
|
| 538 |
"authenticated": False,
|
| 539 |
"reason": exc.detail,
|
| 540 |
"oauth_env": env_status,
|
| 541 |
+
"login_url": "/oauth/huggingface/login",
|
| 542 |
+
"logout_url": "/oauth/huggingface/logout",
|
|
|
|
| 543 |
}
|
| 544 |
)
|
| 545 |
return JSONResponse(
|
|
|
|
| 548 |
"user": public_oauth_context(ctx),
|
| 549 |
"token_identity": verify_token_identity(ctx),
|
| 550 |
"oauth_env": env_status,
|
| 551 |
+
"login_url": "/oauth/huggingface/login",
|
| 552 |
+
"logout_url": "/oauth/huggingface/logout",
|
| 553 |
}
|
| 554 |
)
|
| 555 |
|