Spaces:
Build error
Build error
Download app.py from Hypecat/ChessCommanderFlet: direct link, hf CLI and curl.
- Browser
- Download file 911 Bytes
-
https://huggingface.co/spaces/Hypecat/ChessCommanderFlet/resolve/main/app.py
- Command line
-
hf download hf://spaces/Hypecat/ChessCommanderFlet/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Hypecat/ChessCommanderFlet/resolve/main/app.py
911 Bytes
| from contextlib import asynccontextmanager | |
| import flet.fastapi as flet_fastapi | |
| import logging | |
| from fastapi import FastAPI | |
| from pathlib import Path | |
| from flet_app import main | |
| from js_execution import mount_flet_app | |
| from flet_extensions import extend_flet_page | |
| # Set up basic logging configuration | |
| logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') | |
| logger = logging.getLogger(__name__) | |
| async def lifespan(app: FastAPI): | |
| await flet_fastapi.app_manager.start() | |
| yield | |
| await flet_fastapi.app_manager.shutdown() | |
| app = FastAPI(lifespan=lifespan) | |
| # Extend the Flet Page class | |
| extend_flet_page() | |
| current_dir = Path(__file__).parent.resolve() | |
| assets_path = current_dir / "assets" | |
| # Use the constructed assets path in the flet_fastapi.app call | |
| flet_app = flet_fastapi.app(main, assets_dir=str(assets_path)) | |
| mount_flet_app(app, "/", flet_app) | |