coderuday21 Cursor commited on
Commit
c506ed2
Β·
1 Parent(s): e55b60b

Align production with no-login app and refresh deploy docs

Browse files
DEPLOYMENT.md ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Deployment β€” Two Hugging Face Spaces
2
+
3
+ This project uses **two separate Hugging Face Spaces** so the live app stays stable while you build changes for a new client.
4
+
5
+ | Environment | Space | Git remote | Branch | URL |
6
+ |-------------|-------|------------|--------|-----|
7
+ | **Production** (current clients) | `coderuday21/satdetect` | `hf` | `production` | https://huggingface.co/spaces/coderuday21/satdetect |
8
+ | **Development** (new client work) | `coderuday21/satdetect-dev` | `hf-dev` | `master` | https://huggingface.co/spaces/coderuday21/satdetect-dev |
9
+
10
+ ---
11
+
12
+ ## One-time setup: create the dev Space
13
+
14
+ 1. Open **https://huggingface.co/new-space**
15
+ 2. Set:
16
+ - **Owner:** `coderuday21`
17
+ - **Space name:** `satdetect-dev`
18
+ - **SDK:** Docker
19
+ - **Visibility:** Public (or Private if you prefer)
20
+ 3. Click **Create Space**.
21
+
22
+ Then add the dev remote (once):
23
+
24
+ ```powershell
25
+ cd change_detection_webapp
26
+ git remote add hf-dev https://huggingface.co/spaces/coderuday21/satdetect-dev
27
+ ```
28
+
29
+ If `hf-dev` already exists, update it:
30
+
31
+ ```powershell
32
+ git remote set-url hf-dev https://huggingface.co/spaces/coderuday21/satdetect-dev
33
+ ```
34
+
35
+ Push the current development code to the new Space:
36
+
37
+ ```powershell
38
+ git push hf-dev master:main
39
+ ```
40
+
41
+ Or run the helper script:
42
+
43
+ ```powershell
44
+ .\scripts\push_hf_dev.ps1
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Branch strategy
50
+
51
+ ```
52
+ production ──► hf (satdetect) β€” live app (no login; direct to detection)
53
+ master ──► hf-dev (satdetect-dev) β€” new client experiments and upcoming changes
54
+ ```
55
+
56
+ - **`production`** β€” tracks the stable live release (currently same as `master`, no login).
57
+ - **`master`** β€” active development; push to the dev Space for testing before promoting to production.
58
+
59
+ Work on new client features on `master`. When ready for the live app, merge into `production` and push to `hf`.
60
+
61
+ ---
62
+
63
+ ## Deploy commands
64
+
65
+ ### Production (live app β€” no login)
66
+
67
+ ```powershell
68
+ git checkout production
69
+ git merge master
70
+ git push hf production:main
71
+ ```
72
+
73
+ Or push `master` directly to production:
74
+
75
+ ```powershell
76
+ git push hf master:main
77
+ ```
78
+
79
+ Helper:
80
+
81
+ ```powershell
82
+ .\scripts\push_hf_production.ps1
83
+ ```
84
+
85
+ ### Development (new client Space)
86
+
87
+ After every change you want on the dev Space:
88
+
89
+ ```powershell
90
+ git checkout master
91
+ git push hf-dev master:main
92
+ ```
93
+
94
+ Helper:
95
+
96
+ ```powershell
97
+ .\scripts\push_hf_dev.ps1
98
+ ```
99
+
100
+ ---
101
+
102
+ ## GitHub (optional mirror)
103
+
104
+ GitHub tracks `master` only:
105
+
106
+ ```powershell
107
+ git push origin master
108
+ ```
109
+
110
+ You can add a `production` branch on GitHub too:
111
+
112
+ ```powershell
113
+ git push origin production
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Environment variables (both Spaces)
119
+
120
+ Set these in each Space’s **Settings β†’ Repository secrets / Variables** if needed:
121
+
122
+ | Variable | Purpose |
123
+ |----------|---------|
124
+ | `SECRET_KEY` | Optional legacy JWT setting (login disabled) |
125
+ | `DATABASE_URL` | PostgreSQL instead of SQLite (optional) |
126
+ | `SMTP_USER` / `SMTP_PASS` | Email notifications via Gmail SMTP |
127
+ | `EMAIL_API_URL` | Custom email API (default in code) |
128
+
129
+ Dev Space can omit `SECRET_KEY` (login is disabled on both Spaces).
130
+
131
+ ---
132
+
133
+ ## Quick reference
134
+
135
+ ```powershell
136
+ # Daily work (new client)
137
+ git checkout master
138
+ # ... edit code ...
139
+ git add .
140
+ git commit -m "Your message"
141
+ git push hf-dev master:main
142
+
143
+ # Update live app (only when ready)
144
+ git checkout production
145
+ git merge master # or cherry-pick specific commits
146
+ git push hf production:main
147
+ git checkout master
148
+ ```
Dockerfile CHANGED
@@ -19,7 +19,7 @@ WORKDIR /app
19
 
20
  # Build-time info + cache-bust:
21
  # Changing APP_BUILD forces Docker to re-run subsequent layers (including pip install).
22
- ARG APP_BUILD=22
23
  ENV APP_BUILD=${APP_BUILD}
24
  RUN echo "Docker build start: APP_BUILD=${APP_BUILD}" && python -V
25
 
 
19
 
20
  # Build-time info + cache-bust:
21
  # Changing APP_BUILD forces Docker to re-run subsequent layers (including pip install).
22
+ ARG APP_BUILD=23
23
  ENV APP_BUILD=${APP_BUILD}
24
  RUN echo "Docker build start: APP_BUILD=${APP_BUILD}" && python -V
25
 
README.md CHANGED
@@ -9,12 +9,12 @@ app_port: 7860
9
 
10
  # Satellite Change Detection β€” Standalone Web App
11
 
12
- Standalone web application for satellite image change detection with **user accounts**, **database storage**, and a **clean, modern UI**.
13
 
14
  ## Features
15
 
16
- - **Login / Register** β€” JWT-based auth, passwords hashed with bcrypt
17
- - **Database** β€” SQLite (or set `DATABASE_URL` for PostgreSQL); stores users and detection runs
18
  - **Change detection** β€” Same model as the original app: AI-based, image difference, feature-based, hybrid
19
  - **Detection menu** β€” Choose between General Change Detection and Landslide Detection (Uttarakhand starter)
20
  - **Pothole detection** β€” Separate detection type for road damage (starter pipeline + future model hook)
@@ -49,7 +49,6 @@ Standalone web application for satellite image change detection with **user acco
49
  ## First run
50
 
51
  - The SQLite DB and `data/` (overlay images) are created automatically on first use.
52
- - Register a new account from the welcome screen, then sign in.
53
  - Upload **Before** and **After** images, choose a method, and click **Run detection**.
54
  - Results appear below; runs are saved in **History**.
55
 
 
9
 
10
  # Satellite Change Detection β€” Standalone Web App
11
 
12
+ Standalone web application for satellite image change detection with **database storage** and a **clean, modern UI**. Opens directly on the detection page β€” no sign-in required.
13
 
14
  ## Features
15
 
16
+ - **Direct access** β€” upload and run detection immediately (no login)
17
+ - **Database** β€” SQLite (or set `DATABASE_URL` for PostgreSQL); stores detection runs
18
  - **Change detection** β€” Same model as the original app: AI-based, image difference, feature-based, hybrid
19
  - **Detection menu** β€” Choose between General Change Detection and Landslide Detection (Uttarakhand starter)
20
  - **Pothole detection** β€” Separate detection type for road damage (starter pipeline + future model hook)
 
49
  ## First run
50
 
51
  - The SQLite DB and `data/` (overlay images) are created automatically on first use.
 
52
  - Upload **Before** and **After** images, choose a method, and click **Run detection**.
53
  - Results appear below; runs are saved in **History**.
54
 
scripts/push_hf_dev.ps1 ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Push master to the dev Hugging Face Space (satdetect-dev).
2
+ $ErrorActionPreference = "Stop"
3
+ Set-Location (Split-Path $PSScriptRoot -Parent)
4
+
5
+ if (-not (git remote get-url hf-dev 2>$null)) {
6
+ Write-Host "Adding remote hf-dev..."
7
+ git remote add hf-dev https://huggingface.co/spaces/coderuday21/satdetect-dev
8
+ }
9
+
10
+ $branch = git rev-parse --abbrev-ref HEAD
11
+ if ($branch -ne "master") {
12
+ Write-Host "Switching to master branch..."
13
+ git checkout master
14
+ }
15
+
16
+ Write-Host "Pushing master -> hf-dev/main (satdetect-dev)..."
17
+ git push hf-dev master:main
18
+ Write-Host "Done. Dev app: https://huggingface.co/spaces/coderuday21/satdetect-dev"
scripts/push_hf_production.ps1 ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Push master (no login) to the live Hugging Face Space (satdetect).
2
+ $ErrorActionPreference = "Stop"
3
+ Set-Location (Split-Path $PSScriptRoot -Parent)
4
+
5
+ if (-not (git remote get-url hf 2>$null)) {
6
+ Write-Error "Remote 'hf' not found. Add it with:`n git remote add hf https://huggingface.co/spaces/coderuday21/satdetect"
7
+ }
8
+
9
+ # Keep production branch aligned with master
10
+ git branch -f production master
11
+
12
+ Write-Host "Pushing master -> hf/main (satdetect, no login)..."
13
+ git push hf master:main
14
+ Write-Host "Done. Live app: https://huggingface.co/spaces/coderuday21/satdetect"
templates/index.html CHANGED
@@ -4,7 +4,7 @@
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
  <title>AI Change Detection</title>
7
- <link rel="stylesheet" href="/static/css/style.css?v=28" />
8
  </head>
9
  <body>
10
  <div class="app">
@@ -233,6 +233,6 @@
233
  </div>
234
  </div>
235
 
236
- <script src="/static/js/app.js?v=42"></script>
237
  </body>
238
  </html>
 
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
  <title>AI Change Detection</title>
7
+ <link rel="stylesheet" href="/static/css/style.css?v=29" />
8
  </head>
9
  <body>
10
  <div class="app">
 
233
  </div>
234
  </div>
235
 
236
+ <script src="/static/js/app.js?v=43"></script>
237
  </body>
238
  </html>