| | """FastAPI web application for video2robot pipeline.""" |
| |
|
| | from pathlib import Path |
| |
|
| | from fastapi import FastAPI, Request |
| | from fastapi.responses import HTMLResponse |
| | from fastapi.staticfiles import StaticFiles |
| | from fastapi.templating import Jinja2Templates |
| |
|
| | from .routers import files, pipeline, projects, viser |
| |
|
| | |
| | WEB_DIR = Path(__file__).parent |
| | TEMPLATES_DIR = WEB_DIR / "templates" |
| | STATIC_DIR = WEB_DIR / "static" |
| |
|
| | |
| | app = FastAPI( |
| | title="video2robot", |
| | description="Video → Human Pose → Robot Motion Pipeline", |
| | version="1.0.0", |
| | ) |
| |
|
| | |
| | app.mount("/static", StaticFiles(directory=str(STATIC_DIR)), name="static") |
| | templates = Jinja2Templates(directory=str(TEMPLATES_DIR)) |
| |
|
| | |
| | app.include_router(projects.router, prefix="/api/projects", tags=["projects"]) |
| | app.include_router(pipeline.router, prefix="/api/pipeline", tags=["pipeline"]) |
| | app.include_router(files.router, prefix="/api/files", tags=["files"]) |
| | app.include_router(viser.router, prefix="/api/viser", tags=["viser"]) |
| |
|
| |
|
| | @app.get("/", response_class=HTMLResponse) |
| | async def index(request: Request): |
| | """Main page.""" |
| | return templates.TemplateResponse("index.html", {"request": request}) |
| |
|
| |
|
| | @app.get("/health") |
| | async def health(): |
| | """Health check endpoint.""" |
| | return {"status": "ok"} |
| |
|