| from fastapi import FastAPI | |
| from fastapi.responses import RedirectResponse | |
| import subprocess | |
| import threading | |
| app = FastAPI() | |
| # Start Open WebUI in background | |
| threading.Thread( | |
| target=lambda: subprocess.run(["open-webui", "serve"]), | |
| daemon=True | |
| ).start() | |
| # Redirect to Open WebUI's port (8080) | |
| def home(): | |
| return RedirectResponse(url="http://localhost:8080") |