File size: 12,416 Bytes
401aaf2
 
 
 
 
3d4e00e
c506ed2
401aaf2
 
 
e55b60b
 
a068757
e55b60b
 
 
401aaf2
a068757
401aaf2
 
 
 
b31590e
 
401aaf2
e5c85f7
b31590e
401aaf2
 
92ca429
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401aaf2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ba4abf7
 
 
dfe265a
 
 
 
 
 
 
aa4d14b
dfe265a
 
 
 
 
 
 
 
401aaf2
c2dff01
 
 
 
 
 
 
 
 
 
19f4fba
 
 
 
 
 
 
 
 
5383f21
 
 
 
 
19f4fba
 
401aaf2
 
 
 
 
 
 
 
 
 
c9b0675
401aaf2
b31590e
 
401aaf2
e5c85f7
b31590e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401aaf2
b31590e
401aaf2
 
 
 
 
c9b0675
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65d2d3e
c9b0675
 
 
 
401aaf2
 
 
 
 
 
 
 
 
 
 
 
c506ed2
401aaf2
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>AI Change Detection</title>
  <link rel="stylesheet" href="/static/css/style.css?v=29" />
</head>
<body>
  <div class="app">
    <!-- Detection dashboard (shown immediately — no login) -->
    <section id="view-dashboard" class="view active">
      <div class="topbar">
        <div class="app-brand">
          <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M2 12h20"/><path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg>
          <span>AI Change Detection</span>
        </div>
      </div>

      <div id="dashboard-error" class="alert alert-error hidden"></div>
      <div id="dashboard-success" class="alert alert-success hidden"></div>

      <!-- Section 1: Upload / Detection -->
      <div class="card section-upload">
        <div class="card-header">
          <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="var(--grad-start)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
          <h3>Upload / Detection</h3>
        </div>
        <form id="form-detect">
          <div class="location-row">
            <div class="form-group">
              <label for="detect-zone">
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"/><circle cx="12" cy="10" r="3"/></svg>
                Zone
              </label>
              <select id="detect-zone">
                <option value="">— Select Zone —</option>
              </select>
            </div>
            <div class="form-group">
              <label for="detect-village">
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>
                Village / Area
              </label>
              <select id="detect-village" disabled>
                <option value="">— Select Zone first —</option>
              </select>
            </div>
          </div>
          <div class="upload-grid">
            <div class="upload-zone" id="zone-before">
              <input type="file" id="file-before" accept="image/png,image/jpeg,image/jpg" />
              <div class="upload-icon">
                <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
              </div>
              <label for="file-before">Before image <span class="dim">(older)</span></label>
              <div class="filename" id="name-before">No file chosen</div>
              <img class="upload-preview hidden" id="preview-before" alt="" />
            </div>
            <div class="upload-zone" id="zone-after">
              <input type="file" id="file-after" accept="image/png,image/jpeg,image/jpg" />
              <div class="upload-icon">
                <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
              </div>
              <label for="file-after">After image <span class="dim">(current)</span></label>
              <div class="filename" id="name-after">No file chosen</div>
              <img class="upload-preview hidden" id="preview-after" alt="" />
            </div>
          </div>
          <div class="options-row">
            <div class="form-group">
              <label for="detect-title">Title</label>
              <input type="text" id="detect-title" value="Untitled run" placeholder="Run title" />
            </div>
            <p class="form-hint" style="margin:0 0 0.75rem;font-size:0.85rem;color:#6b7280;">
              For Google Earth screenshots: use the same map location, zoom level, and crop for before and after images.
            </p>
            <div class="form-group">
              <label for="detect-method">Method</label>
              <select id="detect-method">
                <option value="AI-Based Deep Learning">AI-Based Deep Learning</option>
                <option value="Image Difference">Image Difference</option>
                <option value="Feature-Based">Feature-Based</option>
                <option value="Hybrid Approach">Hybrid Approach</option>
                <option value="Hybrid AI">Hybrid AI (DL + Multi-Scale)</option>
              </select>
            </div>
            <div class="form-group checkbox-group">
              <label><input type="checkbox" id="detect-registration" checked /> Image Registration</label>
            </div>
            <div class="form-group checkbox-group">
              <label><input type="checkbox" id="detect-normalization" checked /> Radiometric Normalization</label>
            </div>
          </div>
          <div class="options-row">
            <div class="form-group">
              <label for="detect-sensitivity">Detection Sensitivity (0-1)</label>
              <input type="number" id="detect-sensitivity" min="0" max="1" step="0.05" value="0.5" />
            </div>
            <div class="form-group">
              <label for="detect-min-area">Min Region Area (px, optional)</label>
              <input type="number" id="detect-min-area" min="50" max="10000" step="50" placeholder="Auto" />
            </div>
          </div>
          <div class="notify-row">
            <div class="form-group checkbox-group">
              <label><input type="checkbox" id="detect-notify" /> Notify via Email</label>
            </div>
            <div class="form-group notify-email-group hidden" id="notify-email-group">
              <label for="notify-email">
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/><polyline points="22,6 12,13 2,6"/></svg>
                Recipient Email
              </label>
              <div class="notify-email-actions">
                <input type="email" id="notify-email" placeholder="recipient@example.com" />
                <button type="button" class="btn btn-secondary" id="notify-send-btn">Send Test</button>
              </div>
              <div class="notify-help" id="notify-help">Use Send Test to verify email delivery, or run detection to send the report automatically.</div>
            </div>
          </div>
          <div class="run-btn-wrap">
            <button type="submit" class="btn btn-primary btn-lg" id="btn-run">
              <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="5 3 19 12 5 21 5 3"/></svg>
              Run Detection
            </button>
            <span class="loading hidden" id="run-loading"><span class="spinner"></span> Analyzing images...</span>
          </div>
        </form>
      </div>

      <!-- Result View lives in a modal (opened from detection or history "View") -->

      <!-- Section 3: History View (tabular, click row to open result) -->
      <div class="card mt-2 section-history">
        <div class="card-header">
          <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="var(--grad-start)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
          <h3>History View</h3>
        </div>
        <div class="history-table-wrap">
          <table class="history-table" id="history-table">
            <thead>
              <tr>
                <th>Timestamp</th>
                <th>Before</th>
                <th>After</th>
                <th>Result</th>
                <th>Regions</th>
                <th>% Change</th>
                <th>Actions</th>
              </tr>
            </thead>
            <tbody id="history-tbody"></tbody>
          </table>
        </div>
        <div id="history-empty" class="history-empty hidden">No detection runs yet. Upload images above to get started.</div>
      </div>

    </section>
  </div>

  <!-- Result modal (full-screen overlay opened from detection or history) -->
  <div class="result-modal-backdrop hidden" id="result-modal">
    <div class="result-modal">
      <div class="result-modal-header">
        <h3 id="result-modal-title">Result View</h3>
        <button type="button" class="btn-close-modal" id="result-modal-close" aria-label="Close">
          <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
        </button>
      </div>

      <div class="result-stats" id="result-stats"></div>

      <div class="zoom-slider-section">
        <div class="zoom-controls">
          <button type="button" class="btn btn-zoom" id="zoom-out" title="Zoom out" aria-label="Zoom out"></button>
          <span class="zoom-level" id="zoom-level">100%</span>
          <button type="button" class="btn btn-zoom" id="zoom-in" title="Zoom in" aria-label="Zoom in">+</button>
        </div>
        <div class="zoom-wrapper" id="zoom-wrapper">
          <div class="compare-slider compare-slider-zoomed" id="compare-slider">
            <div class="compare-before">
              <img id="compare-before-img" alt="Before" draggable="false" />
              <span class="compare-label compare-label-left">Before</span>
            </div>
            <div class="compare-after" id="compare-after-clip">
              <img id="compare-after-img" alt="Changes detected" draggable="false" />
              <span class="compare-label compare-label-right">Changes</span>
            </div>
            <div class="compare-handle" id="compare-handle">
              <div class="compare-handle-line"></div>
              <div class="compare-handle-knob">
                <svg width="20" height="20" viewBox="0 0 20 20"><path d="M6 10l4-5v10z" fill="currentColor"/><path d="M14 10l-4-5v10z" fill="currentColor"/></svg>
              </div>
              <div class="compare-handle-line"></div>
            </div>
            <div class="region-highlight-overlay" id="region-highlight-overlay"></div>
          </div>
        </div>
      </div>

      <div class="regions-table-wrap">
        <table class="regions-table" id="regions-table">
          <thead>
            <tr>
              <th>#</th>
              <th>Change Type</th>
              <th>Sub-Type</th>
              <th>Severity</th>
              <th>Confidence</th>
              <th>Area (px)</th>
              <th>Coordinates</th>
              <th>Stories</th>
              <th>Height</th>
              <th>Stage</th>
            </tr>
          </thead>
          <tbody id="regions-tbody"></tbody>
        </table>
        <div class="pagination" id="regions-pagination"></div>
      </div>
    </div>
  </div>

  <!-- Delete confirm modal -->
  <div class="modal-backdrop hidden" id="modal-delete">
    <div class="modal">
      <h3>Delete detection run?</h3>
      <p>This will permanently remove this run and its overlay image. This cannot be undone.</p>
      <div class="modal-actions">
        <button class="btn btn-secondary" id="modal-cancel">Cancel</button>
        <button class="btn btn-danger" id="modal-confirm">Delete</button>
      </div>
    </div>
  </div>

  <script src="/static/js/app.js?v=43"></script>
</body>
</html>