Upload 8 files
Browse filesapp.py is a openCV model to detect change between two pictures
- .gitattributes +2 -0
- Sar_app/App.py +90 -0
- Sar_app/requirements.txt +0 -0
- Sar_app/static/Style.css +142 -0
- Sar_app/static/uploads/test_1.jpg +3 -0
- Sar_app/static/uploads/test_2.jpg +3 -0
- Sar_app/templates/index.html +148 -0
- Sar_app/templates/result.html +156 -0
- Sar_app/vercel.json +18 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
Sar_app/static/uploads/test_1.jpg filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
Sar_app/static/uploads/test_2.jpg filter=lfs diff=lfs merge=lfs -text
|
Sar_app/App.py
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from flask import Flask, render_template, request
|
| 2 |
+
import cv2
|
| 3 |
+
import numpy as np
|
| 4 |
+
import os
|
| 5 |
+
from datetime import datetime
|
| 6 |
+
|
| 7 |
+
app = Flask(__name__)
|
| 8 |
+
app.debug = True # <-- CRITICAL DEBUG SETTING ADDED HERE
|
| 9 |
+
UPLOAD_FOLDER = "static/uploads"
|
| 10 |
+
RESULT_FOLDER = "static/results"
|
| 11 |
+
os.makedirs(UPLOAD_FOLDER, exist_ok=True)
|
| 12 |
+
os.makedirs(RESULT_FOLDER, exist_ok=True)
|
| 13 |
+
|
| 14 |
+
def detect_change(before_path, after_path):
|
| 15 |
+
# Load both SAR images in grayscale
|
| 16 |
+
before = cv2.imread(before_path, cv2.IMREAD_GRAYSCALE)
|
| 17 |
+
after = cv2.imread(after_path, cv2.IMREAD_GRAYSCALE)
|
| 18 |
+
|
| 19 |
+
# Resize both images to same shape
|
| 20 |
+
before = cv2.resize(before, (512, 512))
|
| 21 |
+
after = cv2.resize(after, (512, 512))
|
| 22 |
+
|
| 23 |
+
# Apply Gaussian blur to reduce speckle noise
|
| 24 |
+
before_blur = cv2.GaussianBlur(before, (5, 5), 0)
|
| 25 |
+
after_blur = cv2.GaussianBlur(after, (5, 5), 0)
|
| 26 |
+
|
| 27 |
+
# Compute absolute difference
|
| 28 |
+
diff = cv2.absdiff(before_blur, after_blur)
|
| 29 |
+
|
| 30 |
+
# Normalize to 0–255 and apply threshold
|
| 31 |
+
diff_norm = cv2.normalize(diff, None, 0, 255, cv2.NORM_MINMAX)
|
| 32 |
+
_, mask = cv2.threshold(diff_norm, 30, 255, cv2.THRESH_BINARY)
|
| 33 |
+
|
| 34 |
+
# Clean mask (remove small noise)
|
| 35 |
+
kernel = np.ones((3,3), np.uint8)
|
| 36 |
+
mask_clean = cv2.morphologyEx(mask, cv2.MORPH_OPEN, kernel, iterations=2)
|
| 37 |
+
|
| 38 |
+
# Create red overlay
|
| 39 |
+
overlay = cv2.cvtColor(after, cv2.COLOR_GRAY2BGR)
|
| 40 |
+
overlay[mask_clean > 0] = [0, 0, 255]
|
| 41 |
+
|
| 42 |
+
# Compute % area changed
|
| 43 |
+
change_pixels = np.sum(mask_clean > 0)
|
| 44 |
+
total_pixels = mask_clean.size
|
| 45 |
+
change_percent = (change_pixels / total_pixels) * 100
|
| 46 |
+
|
| 47 |
+
# Save result image
|
| 48 |
+
result_filename = f"result_{datetime.now().strftime('%Y%m%d%H%M%S')}.jpg"
|
| 49 |
+
result_path = os.path.join(RESULT_FOLDER, result_filename)
|
| 50 |
+
cv2.imwrite(result_path, overlay)
|
| 51 |
+
|
| 52 |
+
# Create text summary
|
| 53 |
+
if change_percent < 1:
|
| 54 |
+
desc = "Minimal change detected — stable terrain."
|
| 55 |
+
elif change_percent < 5:
|
| 56 |
+
desc = "Minor surface variation — possible light melt or soil shift."
|
| 57 |
+
elif change_percent < 15:
|
| 58 |
+
desc = "Moderate change — possible glacier retreat or localized flood."
|
| 59 |
+
else:
|
| 60 |
+
desc = "Severe change detected — possible flood, heavy melt, or landslide region."
|
| 61 |
+
|
| 62 |
+
analysis = f"Detected {change_percent:.2f}% change area. {desc}"
|
| 63 |
+
|
| 64 |
+
return result_path, analysis
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
@app.route("/", methods=["GET", "POST"])
|
| 68 |
+
def index():
|
| 69 |
+
if request.method == "POST":
|
| 70 |
+
before = request.files["before"]
|
| 71 |
+
after = request.files["after"]
|
| 72 |
+
|
| 73 |
+
before_path = os.path.join(UPLOAD_FOLDER, before.filename)
|
| 74 |
+
after_path = os.path.join(UPLOAD_FOLDER, after.filename)
|
| 75 |
+
before.save(before_path)
|
| 76 |
+
after.save(after_path)
|
| 77 |
+
|
| 78 |
+
result_path, analysis = detect_change(before_path, after_path)
|
| 79 |
+
|
| 80 |
+
return render_template(
|
| 81 |
+
"result.html",
|
| 82 |
+
result_image=result_path,
|
| 83 |
+
analysis=analysis
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
return render_template("index.html")
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
if __name__ == "__main__":
|
| 90 |
+
app.run(debug=True)
|
Sar_app/requirements.txt
ADDED
|
Binary file (80 Bytes). View file
|
|
|
Sar_app/static/Style.css
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* --- Fonts and Reset --- */
|
| 2 |
+
* {
|
| 3 |
+
margin: 0;
|
| 4 |
+
padding: 0;
|
| 5 |
+
box-sizing: border-box;
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
body {
|
| 9 |
+
font-family: 'Montserrat', sans-serif;
|
| 10 |
+
background: url('https://images.unsplash.com/photo-1519681393784-d120267933ba?auto=format&fit=crop&w=1920&q=80') no-repeat center center/cover;
|
| 11 |
+
height: 100vh;
|
| 12 |
+
display: flex;
|
| 13 |
+
align-items: center;
|
| 14 |
+
justify-content: center;
|
| 15 |
+
color: #fff;
|
| 16 |
+
overflow: hidden;
|
| 17 |
+
position: relative;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
/* --- Subtle dark overlay --- */
|
| 21 |
+
body::after {
|
| 22 |
+
content: "";
|
| 23 |
+
position: absolute;
|
| 24 |
+
inset: 0;
|
| 25 |
+
background: rgba(0, 0, 0, 0.55);
|
| 26 |
+
backdrop-filter: blur(4px);
|
| 27 |
+
z-index: 0;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
/* --- Main Container --- */
|
| 31 |
+
.container {
|
| 32 |
+
position: relative;
|
| 33 |
+
z-index: 2;
|
| 34 |
+
background: rgba(20, 20, 20, 0.6);
|
| 35 |
+
border-radius: 20px;
|
| 36 |
+
padding: 3rem 2rem;
|
| 37 |
+
width: 90%;
|
| 38 |
+
max-width: 600px;
|
| 39 |
+
text-align: center;
|
| 40 |
+
box-shadow: 0 0 40px rgba(255, 255, 255, 0.1);
|
| 41 |
+
animation: fadeIn 1.2s ease forwards;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
h1 {
|
| 45 |
+
font-family: 'Playfair Display', serif;
|
| 46 |
+
font-size: 2.2rem;
|
| 47 |
+
margin-bottom: 1.5rem;
|
| 48 |
+
color: #e0e0e0;
|
| 49 |
+
letter-spacing: 1px;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
/* --- Upload Section --- */
|
| 53 |
+
.upload-section {
|
| 54 |
+
display: flex;
|
| 55 |
+
flex-direction: column;
|
| 56 |
+
gap: 1rem;
|
| 57 |
+
margin-bottom: 2rem;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
.upload-section label {
|
| 61 |
+
text-align: left;
|
| 62 |
+
font-weight: 600;
|
| 63 |
+
font-size: 0.95rem;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
input[type="file"] {
|
| 67 |
+
padding: 0.6rem;
|
| 68 |
+
border: none;
|
| 69 |
+
border-radius: 10px;
|
| 70 |
+
background: rgba(255, 255, 255, 0.1);
|
| 71 |
+
color: #ddd;
|
| 72 |
+
cursor: pointer;
|
| 73 |
+
transition: background 0.3s;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
input[type="file"]:hover {
|
| 77 |
+
background: rgba(255, 255, 255, 0.2);
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/* --- Magic Button --- */
|
| 81 |
+
.magic-btn {
|
| 82 |
+
position: relative;
|
| 83 |
+
background: linear-gradient(135deg, #00d4ff, #0061ff);
|
| 84 |
+
color: #fff;
|
| 85 |
+
border: none;
|
| 86 |
+
border-radius: 50px;
|
| 87 |
+
padding: 0.9rem 2rem;
|
| 88 |
+
font-size: 1rem;
|
| 89 |
+
font-weight: 600;
|
| 90 |
+
letter-spacing: 1px;
|
| 91 |
+
cursor: pointer;
|
| 92 |
+
overflow: hidden;
|
| 93 |
+
transition: all 0.4s ease;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
.magic-btn::before {
|
| 97 |
+
content: "";
|
| 98 |
+
position: absolute;
|
| 99 |
+
top: 0;
|
| 100 |
+
left: -75%;
|
| 101 |
+
width: 50%;
|
| 102 |
+
height: 100%;
|
| 103 |
+
background: rgba(255, 255, 255, 0.3);
|
| 104 |
+
transform: skewX(-25deg);
|
| 105 |
+
transition: left 0.5s;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
.magic-btn:hover::before {
|
| 109 |
+
left: 125%;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
.magic-btn:hover {
|
| 113 |
+
transform: scale(1.05);
|
| 114 |
+
box-shadow: 0 0 25px rgba(0, 208, 255, 0.6);
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
/* --- Result Page --- */
|
| 118 |
+
.result-img {
|
| 119 |
+
width: 100%;
|
| 120 |
+
border-radius: 15px;
|
| 121 |
+
margin-top: 1rem;
|
| 122 |
+
box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
.analysis-text {
|
| 126 |
+
margin: 1.5rem 0;
|
| 127 |
+
font-size: 1rem;
|
| 128 |
+
line-height: 1.6;
|
| 129 |
+
color: #f1f1f1;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
/* --- Animation --- */
|
| 133 |
+
@keyframes fadeIn {
|
| 134 |
+
0% { opacity: 0; transform: translateY(40px); }
|
| 135 |
+
100% { opacity: 1; transform: translateY(0); }
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
/* --- Responsive --- */
|
| 139 |
+
@media (max-width: 600px) {
|
| 140 |
+
h1 { font-size: 1.8rem; }
|
| 141 |
+
.magic-btn { padding: 0.8rem 1.8rem; font-size: 0.9rem; }
|
| 142 |
+
}
|
Sar_app/static/uploads/test_1.jpg
ADDED
|
Git LFS Details
|
Sar_app/static/uploads/test_2.jpg
ADDED
|
Git LFS Details
|
Sar_app/templates/index.html
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<title>Upload Images | GeoFlood Analysis</title>
|
| 6 |
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
| 7 |
+
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600&family=Poppins:wght@400;500&display=swap" rel="stylesheet">
|
| 8 |
+
<style>
|
| 9 |
+
body {
|
| 10 |
+
margin: 0;
|
| 11 |
+
height: 100vh;
|
| 12 |
+
display: flex;
|
| 13 |
+
font-family: 'Poppins', sans-serif;
|
| 14 |
+
background-color: #0d0d0f;
|
| 15 |
+
color: #e0e0e0;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
.left-panel {
|
| 19 |
+
flex: 1;
|
| 20 |
+
background: radial-gradient(circle at top, rgba(44 183 255 / 40%), rgba(0, 0, 0, 0.95));
|
| 21 |
+
display: flex;
|
| 22 |
+
flex-direction: column;
|
| 23 |
+
justify-content: center;
|
| 24 |
+
align-items: center;
|
| 25 |
+
text-align: center;
|
| 26 |
+
padding: 2rem;
|
| 27 |
+
border-right: 1px solid rgba(255, 255, 255, 0.05);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
.left-panel h1 {
|
| 31 |
+
font-family: 'Playfair Display', serif;
|
| 32 |
+
font-size: 2.5rem;
|
| 33 |
+
color: #fff;
|
| 34 |
+
margin-bottom: 0.8rem;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.left-panel p {
|
| 38 |
+
font-size: 1rem;
|
| 39 |
+
opacity: 0.8;
|
| 40 |
+
max-width: 400px;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
.right-panel {
|
| 44 |
+
flex: 1;
|
| 45 |
+
display: flex;
|
| 46 |
+
align-items: center;
|
| 47 |
+
justify-content: center;
|
| 48 |
+
padding: 2rem;
|
| 49 |
+
background: #0d0d0f;
|
| 50 |
+
overflow-y: auto;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
.upload-card {
|
| 54 |
+
width: 100%;
|
| 55 |
+
max-width: 420px;
|
| 56 |
+
background-color: #1d1d23fa;
|
| 57 |
+
border-radius: 18px;
|
| 58 |
+
padding: 2.5rem;
|
| 59 |
+
box-shadow: 0 0 40px rgba(0 170 255 / 10%);
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
.upload-card h2 {
|
| 63 |
+
font-family: 'Playfair Display', serif;
|
| 64 |
+
font-size: 1.7rem;
|
| 65 |
+
margin-bottom: 1.5rem;
|
| 66 |
+
text-align: center;
|
| 67 |
+
color: #fff;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
.form-control-file {
|
| 71 |
+
background-color: #1a1a1d;
|
| 72 |
+
border: 1px solid #333;
|
| 73 |
+
border-radius: 10px;
|
| 74 |
+
padding: 1rem;
|
| 75 |
+
width: 100%;
|
| 76 |
+
color: #ccc;
|
| 77 |
+
cursor: pointer;
|
| 78 |
+
transition: all 0.3s ease;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
.form-control-file:hover {
|
| 82 |
+
background-color: #222226;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
.btn-primary {
|
| 86 |
+
background: linear-gradient(135deg, #25b5ff, #0c6ca6);
|
| 87 |
+
border: none;
|
| 88 |
+
border-radius: 12px;
|
| 89 |
+
width: 100%;
|
| 90 |
+
padding: 0.8rem;
|
| 91 |
+
font-weight: 500;
|
| 92 |
+
margin-top: 1rem;
|
| 93 |
+
transition: 0.3s ease;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
.btn-primary:hover {
|
| 97 |
+
transform: scale(1.03);
|
| 98 |
+
box-shadow: 0 0 15px rgba(160, 96, 255, 0.3);
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
.footer {
|
| 102 |
+
font-size: 0.85rem;
|
| 103 |
+
opacity: 0.6;
|
| 104 |
+
margin-top: 1.5rem;
|
| 105 |
+
text-align: center;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
@media (max-width: 768px) {
|
| 109 |
+
body {
|
| 110 |
+
flex-direction: column;
|
| 111 |
+
}
|
| 112 |
+
.left-panel {
|
| 113 |
+
border-right: none;
|
| 114 |
+
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
| 115 |
+
padding: 3rem 1rem;
|
| 116 |
+
}
|
| 117 |
+
.upload-card {
|
| 118 |
+
margin-top: 1rem;
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
</style>
|
| 122 |
+
</head>
|
| 123 |
+
<body>
|
| 124 |
+
<div class="left-panel">
|
| 125 |
+
<h1>GeoFlood AI</h1>
|
| 126 |
+
<p>Upload your pre- and post-disaster satellite images to analyze flood impact intelligently. Get detailed visual and textual insights powered by AI.</p>
|
| 127 |
+
</div>
|
| 128 |
+
|
| 129 |
+
<div class="right-panel">
|
| 130 |
+
<form action="/" method="post" enctype="multipart/form-data" class="upload-card">
|
| 131 |
+
<h2>Upload Image Pair</h2>
|
| 132 |
+
<div class="form-group">
|
| 133 |
+
<label>Upload BEFORE image:</label>
|
| 134 |
+
<input type="file" name="before" accept="image/*" required class="form-control-file">
|
| 135 |
+
</div>
|
| 136 |
+
<div class="form-group">
|
| 137 |
+
<label>Upload AFTER image:</label>
|
| 138 |
+
<input type="file" name="after" accept="image/*" required class="form-control-file">
|
| 139 |
+
</div>
|
| 140 |
+
|
| 141 |
+
<button type="submit" class="btn btn-primary">Analyze</button>
|
| 142 |
+
<div class="footer">
|
| 143 |
+
<p>AI-powered analysis to visualize environmental change.</p>
|
| 144 |
+
</div>
|
| 145 |
+
</form>
|
| 146 |
+
</div>
|
| 147 |
+
</body>
|
| 148 |
+
</html>
|
Sar_app/templates/result.html
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<title>Analysis Result</title>
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
| 7 |
+
|
| 8 |
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
| 9 |
+
<style>
|
| 10 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Playfair+Display:wght@600&display=swap');
|
| 11 |
+
|
| 12 |
+
body {
|
| 13 |
+
background: #0e0e11;
|
| 14 |
+
background: radial-gradient(circle at top left, #0d5daa, #13161d 65%);
|
| 15 |
+
font-family: 'Outfit', sans-serif;
|
| 16 |
+
color: #f5f5f5;
|
| 17 |
+
margin: 0;
|
| 18 |
+
padding: 0;
|
| 19 |
+
height: 100vh;
|
| 20 |
+
display: flex;
|
| 21 |
+
align-items: center;
|
| 22 |
+
justify-content: center;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
.wrapper {
|
| 26 |
+
display: flex;
|
| 27 |
+
width: 90%;
|
| 28 |
+
max-width: 1100px;
|
| 29 |
+
min-height: 600px;
|
| 30 |
+
height: 95%;
|
| 31 |
+
background: rgba(15, 15, 20, 0.85);
|
| 32 |
+
backdrop-filter: blur(20px);
|
| 33 |
+
border-radius: 20px;
|
| 34 |
+
box-shadow: 0 0 40px rgba(0,0,0,0.5);
|
| 35 |
+
overflow: hidden;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
.left {
|
| 39 |
+
flex: 0.9;
|
| 40 |
+
background: linear-gradient(180deg, rgb(17 126 203), rgb(36 41 57 / 95%));
|
| 41 |
+
color: #fff;
|
| 42 |
+
display: flex;
|
| 43 |
+
flex-direction: column;
|
| 44 |
+
justify-content: center;
|
| 45 |
+
align-items: center;
|
| 46 |
+
text-align: center;
|
| 47 |
+
padding: 3rem 2rem;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.left h1 {
|
| 51 |
+
font-family: 'Playfair Display', serif;
|
| 52 |
+
font-size: 2.2rem;
|
| 53 |
+
margin-bottom: 1rem;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
.left p {
|
| 57 |
+
font-size: 1rem;
|
| 58 |
+
max-width: 80%;
|
| 59 |
+
color: #d4d4d4;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
.right {
|
| 63 |
+
flex: 1.1;
|
| 64 |
+
padding: 3rem 2rem;
|
| 65 |
+
display: flex;
|
| 66 |
+
flex-direction: column;
|
| 67 |
+
align-items: center;
|
| 68 |
+
justify-content: center;
|
| 69 |
+
overflow-y: auto;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
.lead {
|
| 73 |
+
font-size: 1.05rem;
|
| 74 |
+
line-height: 1.7;
|
| 75 |
+
text-align: justify;
|
| 76 |
+
color: #ccc;
|
| 77 |
+
margin-bottom: 2rem;
|
| 78 |
+
max-width: 85%;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
img {
|
| 82 |
+
max-width: 85%;
|
| 83 |
+
height: auto;
|
| 84 |
+
border-radius: 14px;
|
| 85 |
+
box-shadow: 0 0 25px rgba(0,0,0,0.5);
|
| 86 |
+
margin-bottom: 2rem;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
.btn {
|
| 90 |
+
background: linear-gradient(135deg, #6b85ff, #5e68f9);
|
| 91 |
+
color: #fff;
|
| 92 |
+
border: none;
|
| 93 |
+
border-radius: 10px;
|
| 94 |
+
padding: 0.8rem 1.8rem;
|
| 95 |
+
font-weight: 500;
|
| 96 |
+
transition: all 0.3s ease;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
.btn:hover {
|
| 100 |
+
background: linear-gradient(135deg, #5f85bd, #4b5adb);
|
| 101 |
+
transform: translateY(-2px);
|
| 102 |
+
box-shadow: 0 5px 20px rgba(107 121 255 / 30%);
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
footer {
|
| 106 |
+
text-align: center;
|
| 107 |
+
margin-top: 1rem;
|
| 108 |
+
font-size: 0.85rem;
|
| 109 |
+
color: #777;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
@media (max-width: 992px) {
|
| 113 |
+
.wrapper {
|
| 114 |
+
flex-direction: column;
|
| 115 |
+
min-height: auto;
|
| 116 |
+
width: 95%;
|
| 117 |
+
}
|
| 118 |
+
.left, .right {
|
| 119 |
+
width: 100%;
|
| 120 |
+
padding: 2rem 1.5rem;
|
| 121 |
+
}
|
| 122 |
+
img, .lead {
|
| 123 |
+
max-width: 100%;
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
::-webkit-scrollbar {
|
| 128 |
+
width: 8px;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
::-webkit-scrollbar-thumb {
|
| 132 |
+
background: #333;
|
| 133 |
+
border-radius: 10px;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
::-webkit-scrollbar-track {
|
| 137 |
+
background: transparent;
|
| 138 |
+
}
|
| 139 |
+
</style>
|
| 140 |
+
</head>
|
| 141 |
+
<body>
|
| 142 |
+
<div class="wrapper">
|
| 143 |
+
<div class="left">
|
| 144 |
+
<h1>Terrain Change Analysis</h1>
|
| 145 |
+
<p>Smart SAR-based detection model to visualize glacier retreat, floods, and environmental shifts.</p>
|
| 146 |
+
</div>
|
| 147 |
+
|
| 148 |
+
<div class="right">
|
| 149 |
+
<p class="lead">{{ analysis }}</p>
|
| 150 |
+
<img src="{{ result_image }}" alt="Result Image">
|
| 151 |
+
<a href="/" class="btn">Upload Another Pair</a>
|
| 152 |
+
<footer>© 2025 Cosmic Narrator — Flood Impact Detection Project</footer>
|
| 153 |
+
</div>
|
| 154 |
+
</div>
|
| 155 |
+
</body>
|
| 156 |
+
</html>
|
Sar_app/vercel.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": 2,
|
| 3 |
+
"builds": [
|
| 4 |
+
{
|
| 5 |
+
"src": "App.py",
|
| 6 |
+
"use": "@vercel/python",
|
| 7 |
+
"config": {
|
| 8 |
+
"runtime": "python3.11"
|
| 9 |
+
}
|
| 10 |
+
}
|
| 11 |
+
],
|
| 12 |
+
"routes": [
|
| 13 |
+
{
|
| 14 |
+
"src": "/(.*)",
|
| 15 |
+
"dest": "App.py"
|
| 16 |
+
}
|
| 17 |
+
]
|
| 18 |
+
}
|