From 29d34ae6ada5807dabf08ae039080f826a53d210 Mon Sep 17 00:00:00 2001 From: Adam Ladachowski Date: Sat, 14 Feb 2026 03:02:53 +0100 Subject: [PATCH] Add simple web gallery UI - Mobile-friendly responsive grid - GLightbox for lightbox functionality (CDN) - Served at root (/) endpoint Co-Authored-By: Claude Opus 4.5 --- tensors/server/__init__.py | 10 ++++ tensors/server/static/index.html | 96 ++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 tensors/server/static/index.html diff --git a/tensors/server/__init__.py b/tensors/server/__init__.py index 7c4e8dc..83a0f08 100644 --- a/tensors/server/__init__.py +++ b/tensors/server/__init__.py @@ -4,10 +4,12 @@ from __future__ import annotations import logging from contextlib import asynccontextmanager +from pathlib import Path from typing import TYPE_CHECKING import httpx from fastapi import FastAPI +from fastapi.responses import FileResponse from tensors.server.db_routes import create_db_router from tensors.server.download_routes import create_download_router @@ -46,6 +48,14 @@ def create_app(config: ServerConfig | None = None) -> FastAPI: pm.stop() app = FastAPI(title="sd-server wrapper", lifespan=lifespan) + + # Serve gallery UI at root + static_dir = Path(__file__).parent / "static" + + @app.get("/", include_in_schema=False) + async def gallery_ui() -> FileResponse: + return FileResponse(static_dir / "index.html") + app.include_router(create_db_router()) # Must be before catch-all proxy app.include_router(create_gallery_router()) # Must be before catch-all proxy app.include_router(create_models_router(pm)) # Must be before catch-all proxy diff --git a/tensors/server/static/index.html b/tensors/server/static/index.html new file mode 100644 index 0000000..8b45a82 --- /dev/null +++ b/tensors/server/static/index.html @@ -0,0 +1,96 @@ + + + + + + tsr Gallery + + + + +
+

tsr Gallery

+
+
+ +
+ + + + +