Spaces:
No application file
No application file
Update app.py
Browse files
app.py
CHANGED
|
@@ -99,6 +99,19 @@ app = FastAPI(
|
|
| 99 |
lifespan=lifespan
|
| 100 |
)
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
app.add_middleware(
|
| 103 |
CORSMiddleware,
|
| 104 |
allow_origins=["*"],
|
|
|
|
| 99 |
lifespan=lifespan
|
| 100 |
)
|
| 101 |
|
| 102 |
+
# ---------- serve the single-page UI at “/” ----------
|
| 103 |
+
BASE_DIR = pathlib.Path(__file__).resolve().parent
|
| 104 |
+
UI_FILE = BASE_DIR / "browser_automation_ui.html" # adjust if you stored it elsewhere
|
| 105 |
+
|
| 106 |
+
@app.get("/", response_class=HTMLResponse)
|
| 107 |
+
async def root_ui():
|
| 108 |
+
"""Return the front-end SPA."""
|
| 109 |
+
return FileResponse(UI_FILE)
|
| 110 |
+
|
| 111 |
+
# (Optional) if you later add JS/CSS images, create a /static mount
|
| 112 |
+
# app.mount("/static", StaticFiles(directory=BASE_DIR / "static"), name="static")
|
| 113 |
+
# ------------------------------------------------------
|
| 114 |
+
|
| 115 |
app.add_middleware(
|
| 116 |
CORSMiddleware,
|
| 117 |
allow_origins=["*"],
|