Spaces:
Sleeping
Sleeping
| title: SatDetect - Satellite Change Detection | |
| emoji: π°οΈ | |
| colorFrom: gray | |
| colorTo: green | |
| sdk: docker | |
| app_port: 7860 | |
| # Satellite Change Detection β Standalone Web App | |
| Standalone web application for satellite image change detection with **user accounts**, **database storage**, and a **clean, modern UI**. | |
| ## Features | |
| - **Login / Register** β JWT-based auth, passwords hashed with bcrypt | |
| - **Database** β SQLite (or set `DATABASE_URL` for PostgreSQL); stores users and detection runs | |
| - **Change detection** β Same model as the original app: AI-based, image difference, feature-based, hybrid | |
| - **Object classification** β Changed regions labeled as Water, Vegetation/Tree, Building, Road, Bare Ground/Soil | |
| - **History** β List of past runs with overlay images and stats | |
| - **UI** β Single-page app with a dark, βcontrol roomβ style and teal accents | |
| ## Setup | |
| 1. **Create a virtual environment (recommended)** | |
| ```bash | |
| cd change_detection_webapp | |
| python -m venv venv | |
| source venv/bin/activate # Windows: venv\Scripts\activate | |
| ``` | |
| 2. **Install dependencies** | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| 3. **Run the app** | |
| ```bash | |
| uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 | |
| ``` | |
| 4. Open **http://localhost:8000** in your browser. | |
| ## First run | |
| - The SQLite DB and `data/` (overlay images) are created automatically on first use. | |
| - Register a new account from the welcome screen, then sign in. | |
| - Upload **Before** and **After** images, choose a method, and click **Run detection**. | |
| - Results appear below; runs are saved in **History**. | |
| ## Configuration | |
| - **Database**: set `DATABASE_URL` (e.g. `postgresql://user:pass@host/db`) to use another DB; otherwise SQLite under `data/satellite_app.db` is used. | |
| - **JWT**: set `SECRET_KEY` in `app/auth.py` (or via env) in production. | |
| ## Project layout | |
| ``` | |
| change_detection_webapp/ | |
| βββ app/ | |
| β βββ main.py # FastAPI app, routes | |
| β βββ database.py # SQLAlchemy, session | |
| β βββ models.py # User, DetectionRun | |
| β βββ auth.py # JWT, password hashing | |
| β βββ detection_engine.py # Change detection (no Streamlit) | |
| βββ static/ | |
| β βββ css/style.css # Styles | |
| β βββ js/app.js # Frontend logic | |
| βββ templates/ | |
| β βββ index.html # Single-page UI | |
| βββ data/ # Created at runtime (DB + overlays) | |
| βββ requirements.txt | |
| βββ README.md | |
| ``` | |
| ## API (for integration) | |
| - `POST /api/auth/register` β body: `{ "email", "password", "full_name" }` | |
| - `POST /api/auth/login` β body: `{ "email", "password" }` β returns `access_token` | |
| - `GET /api/me` β header: `Authorization: Bearer <token>` | |
| - `POST /api/detect` β form: `before`, `after` (files), `method`, `title`, etc. β returns stats, regions, overlay base64 | |
| - `GET /api/history` β list of current userβs runs | |
| - `GET /api/overlay/<path>` β serve saved overlay image | |