Spaces:
No application file
No application file
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,6 +15,9 @@ import uvicorn
|
|
| 15 |
from fastapi import FastAPI, HTTPException, BackgroundTasks
|
| 16 |
from fastapi.middleware.cors import CORSMiddleware
|
| 17 |
from fastapi.responses import JSONResponse
|
|
|
|
|
|
|
|
|
|
| 18 |
from pydantic import BaseModel
|
| 19 |
from playwright.async_api import async_playwright, Browser, BrowserContext, Page
|
| 20 |
from selenium import webdriver
|
|
@@ -100,8 +103,10 @@ app = FastAPI(
|
|
| 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():
|
|
|
|
| 15 |
from fastapi import FastAPI, HTTPException, BackgroundTasks
|
| 16 |
from fastapi.middleware.cors import CORSMiddleware
|
| 17 |
from fastapi.responses import JSONResponse
|
| 18 |
+
from fastapi.responses import FileResponse, HTMLResponse
|
| 19 |
+
from fastapi.staticfiles import StaticFiles
|
| 20 |
+
from pathlib import Path
|
| 21 |
from pydantic import BaseModel
|
| 22 |
from playwright.async_api import async_playwright, Browser, BrowserContext, Page
|
| 23 |
from selenium import webdriver
|
|
|
|
| 103 |
)
|
| 104 |
|
| 105 |
# ---------- serve the single-page UI at “/” ----------
|
| 106 |
+
#BASE_DIR = pathlib.Path(__file__).resolve().parent
|
| 107 |
+
#UI_FILE = BASE_DIR / "browser_automation_ui.html" # adjust if you stored it elsewhere
|
| 108 |
+
BASE_DIR = Path(__file__).resolve().parent
|
| 109 |
+
UI_FILE = BASE_DIR / "browser_automation_ui.html"
|
| 110 |
|
| 111 |
@app.get("/", response_class=HTMLResponse)
|
| 112 |
async def root_ui():
|