Spaces:
Running
Running
privacy modals; minor improvement
Browse files- backend/constants.py +0 -14
- backend/engine.py +1 -2
- backend/pcu.py +6 -1
- backend/server.py +10 -1
- frontend/initial.html +80 -0
backend/constants.py
DELETED
|
@@ -1,14 +0,0 @@
|
|
| 1 |
-
MODEL_CLASSES = {
|
| 2 |
-
0: "Hatchback", 1: "Sedan", 2: "SUV", 3: "MUV", 4: "Bus", 5: "Truck",
|
| 3 |
-
6: "Three-wheeler", 7: "Two-wheeler", 8: "LCV", 9: "Mini-bus",
|
| 4 |
-
10: "Tempo-traveller", 11: "Bicycle", 12: "Van", 13: "Others"
|
| 5 |
-
}
|
| 6 |
-
|
| 7 |
-
BUSINESS_MAP = {
|
| 8 |
-
"Cars": [0, 1, 2, 3, 12],
|
| 9 |
-
"Buses": [4, 9, 10],
|
| 10 |
-
"Two-wheelers": [7, 11],
|
| 11 |
-
"Three-wheelers": [6],
|
| 12 |
-
"Trucks": [5, 8],
|
| 13 |
-
"Others": [13]
|
| 14 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backend/engine.py
CHANGED
|
@@ -6,10 +6,9 @@ import queue
|
|
| 6 |
import numpy as np
|
| 7 |
import cv2
|
| 8 |
from collections import defaultdict
|
| 9 |
-
from
|
| 10 |
from tracker_config import get_tracker_path
|
| 11 |
from speed import estimate_speeds
|
| 12 |
-
from pcu import compute_pcu
|
| 13 |
|
| 14 |
|
| 15 |
def _side(p, a, b):
|
|
|
|
| 6 |
import numpy as np
|
| 7 |
import cv2
|
| 8 |
from collections import defaultdict
|
| 9 |
+
from pcu import compute_pcu, MODEL_CLASSES
|
| 10 |
from tracker_config import get_tracker_path
|
| 11 |
from speed import estimate_speeds
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
def _side(p, a, b):
|
backend/pcu.py
CHANGED
|
@@ -4,7 +4,12 @@ Passenger Car Unit (PCU) conversion using IRC:106-1990 guidelines.
|
|
| 4 |
PCU normalizes heterogeneous Indian traffic into a single unit of measurement
|
| 5 |
used by transport authorities for capacity analysis and road design.
|
| 6 |
"""
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# IRC:106-1990 PCU equivalency factors
|
| 10 |
_PCU_TABLE = {
|
|
|
|
| 4 |
PCU normalizes heterogeneous Indian traffic into a single unit of measurement
|
| 5 |
used by transport authorities for capacity analysis and road design.
|
| 6 |
"""
|
| 7 |
+
MODEL_CLASSES = {
|
| 8 |
+
0: "Hatchback", 1: "Sedan", 2: "SUV", 3: "MUV", 4: "Bus", 5: "Truck",
|
| 9 |
+
6: "Three-wheeler", 7: "Two-wheeler", 8: "LCV", 9: "Mini-bus",
|
| 10 |
+
10: "Tempo-traveller", 11: "Bicycle", 12: "Van", 13: "Others"
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
|
| 14 |
# IRC:106-1990 PCU equivalency factors
|
| 15 |
_PCU_TABLE = {
|
backend/server.py
CHANGED
|
@@ -15,9 +15,18 @@ from fastapi.staticfiles import StaticFiles
|
|
| 15 |
from model import load_model
|
| 16 |
from config import get_optimal_config
|
| 17 |
from engine import run
|
| 18 |
-
from
|
| 19 |
from visualize import generate_all
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
from contextlib import asynccontextmanager
|
| 22 |
import numpy as np
|
| 23 |
|
|
|
|
| 15 |
from model import load_model
|
| 16 |
from config import get_optimal_config
|
| 17 |
from engine import run
|
| 18 |
+
from pcu import MODEL_CLASSES
|
| 19 |
from visualize import generate_all
|
| 20 |
|
| 21 |
+
BUSINESS_MAP = {
|
| 22 |
+
"Cars": [0, 1, 2, 3, 12],
|
| 23 |
+
"Buses": [4, 9, 10],
|
| 24 |
+
"Two-wheelers": [7, 11],
|
| 25 |
+
"Three-wheelers": [6],
|
| 26 |
+
"Trucks": [5, 8],
|
| 27 |
+
"Others": [13]
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
from contextlib import asynccontextmanager
|
| 31 |
import numpy as np
|
| 32 |
|
frontend/initial.html
CHANGED
|
@@ -123,7 +123,87 @@
|
|
| 123 |
</div>
|
| 124 |
</main>
|
| 125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
<script src="js/initial.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
<!-- Onboarding Walkthrough -->
|
| 129 |
<div id="onboard-overlay" class="onboard-overlay" style="display:none">
|
|
|
|
| 123 |
</div>
|
| 124 |
</main>
|
| 125 |
|
| 126 |
+
<footer class="w-full max-w-[90rem] mx-auto px-10 py-8 mt-auto flex flex-col md:flex-row justify-between items-center text-[10px] font-bold uppercase tracking-[0.2em] z-10" style="color:#444">
|
| 127 |
+
<div class="mb-4 md:mb-0">
|
| 128 |
+
<button onclick="openAppModal('privacyModal')" class="hover:text-white transition">Privacy Policy</button>
|
| 129 |
+
</div>
|
| 130 |
+
<div class="mb-4 md:mb-0">
|
| 131 |
+
<button onclick="openAppModal('termsModal')" class="hover:text-white transition">Terms & Conditions</button>
|
| 132 |
+
</div>
|
| 133 |
+
<div>
|
| 134 |
+
© 2026 UrbanFlow. All rights reserved.
|
| 135 |
+
</div>
|
| 136 |
+
</footer>
|
| 137 |
+
|
| 138 |
<script src="js/initial.js"></script>
|
| 139 |
+
<script>
|
| 140 |
+
function openAppModal(id) {
|
| 141 |
+
const el = document.getElementById('appModal-' + id);
|
| 142 |
+
if (el) { el.style.display = 'flex'; document.body.style.overflow = 'hidden'; }
|
| 143 |
+
}
|
| 144 |
+
function closeAppModal(id) {
|
| 145 |
+
const el = document.getElementById('appModal-' + id);
|
| 146 |
+
if (el) { el.style.display = 'none'; document.body.style.overflow = ''; }
|
| 147 |
+
}
|
| 148 |
+
document.addEventListener('keydown', function (e) {
|
| 149 |
+
if (e.key === 'Escape') { closeAppModal('privacyModal'); closeAppModal('termsModal'); }
|
| 150 |
+
});
|
| 151 |
+
</script>
|
| 152 |
+
|
| 153 |
+
<!-- Privacy Modal -->
|
| 154 |
+
<div id="appModal-privacyModal" onclick="if(event.target===this)closeAppModal('privacyModal')"
|
| 155 |
+
style="display:none;position:fixed;inset:0;background:rgba(0,0,0,0.85);z-index:9999;align-items:center;justify-content:center;padding:24px">
|
| 156 |
+
<div
|
| 157 |
+
style="background:#0a0a0a;border:1px solid #2a2a2a;border-radius:14px;max-width:480px;width:100%;padding:32px;position:relative;max-height:80vh;overflow-y:auto">
|
| 158 |
+
<button onclick="closeAppModal('privacyModal')"
|
| 159 |
+
style="position:absolute;top:16px;right:18px;background:none;border:none;color:#a89f97;font-size:18px;cursor:pointer">×</button>
|
| 160 |
+
<h2 style="color:#f0ece6;font-size:1.1rem;font-weight:700;margin-bottom:8px">Privacy Policy</h2>
|
| 161 |
+
<p style="color:#a89f97;font-size:11px;margin-bottom:20px">We keep this simple and honest.</p>
|
| 162 |
+
<ul style="color:#a89f97;font-size:11px;line-height:1.9;padding-left:16px;list-style:disc;text-align:left">
|
| 163 |
+
<li>This is a <strong style="color:#f0ece6">public demo</strong> hosted on Hugging Face Spaces. It is not a production service.</li>
|
| 164 |
+
<li>Footage you submit is processed in real time and <strong style="color:#f0ece6">discarded immediately</strong> after the session ends. Nothing is stored on our servers.</li>
|
| 165 |
+
<li>We do not use your footage to train models, sell it, or share it with any third party.</li>
|
| 166 |
+
<li>Reports and annotated videos are generated temporarily and delivered to your device. We do not retain copies.</li>
|
| 167 |
+
<li>We do not use advertising cookies, behavioral tracking, or analytics scripts on this platform.</li>
|
| 168 |
+
<li>Your use of this demo may inform product requirements. No personally identifiable data is collected in that process.</li>
|
| 169 |
+
<li>For any queries: <strong style="color:#c89a6c">support@urbanflow.in</strong></li>
|
| 170 |
+
</ul>
|
| 171 |
+
<p style="color:#555;font-size:10px;margin-top:20px;text-align:left">— Team UrbanFlow</p>
|
| 172 |
+
</div>
|
| 173 |
+
</div>
|
| 174 |
+
|
| 175 |
+
<!-- Terms Modal -->
|
| 176 |
+
<div id="appModal-termsModal" onclick="if(event.target===this)closeAppModal('termsModal')"
|
| 177 |
+
style="display:none;position:fixed;inset:0;background:rgba(0,0,0,0.85);z-index:9999;align-items:center;justify-content:center;padding:24px">
|
| 178 |
+
<div
|
| 179 |
+
style="background:#0a0a0a;border:1px solid #2a2a2a;border-radius:14px;max-width:480px;width:100%;padding:32px;position:relative;max-height:80vh;overflow-y:auto">
|
| 180 |
+
<button onclick="closeAppModal('termsModal')"
|
| 181 |
+
style="position:absolute;top:16px;right:18px;background:none;border:none;color:#a89f97;font-size:18px;cursor:pointer">×</button>
|
| 182 |
+
<h2 style="color:#f0ece6;font-size:1.1rem;font-weight:700;margin-bottom:8px">Terms & Conditions</h2>
|
| 183 |
+
<p style="color:#a89f97;font-size:11px;margin-bottom:20px">By using this demo platform, you agree to the
|
| 184 |
+
following terms.</p>
|
| 185 |
+
<p style="color:#c89a6c;font-size:11px;font-weight:700;margin-bottom:6px;text-align:left">You can:</p>
|
| 186 |
+
<ul
|
| 187 |
+
style="color:#a89f97;font-size:11px;line-height:1.9;padding-left:16px;list-style:disc;margin-bottom:16px;text-align:left">
|
| 188 |
+
<li>Use this demo to evaluate UrbanFlow’s traffic detection and analytics capabilities.</li>
|
| 189 |
+
<li>Export reports, annotated video outputs, and data artifacts to your own device.</li>
|
| 190 |
+
<li>Share feedback, feature requests, or questions with us at <strong style="color:#c89a6c">support@urbanflow.in</strong>.</li>
|
| 191 |
+
<li>Reference this demo in research or internal evaluation, with proper attribution.</li>
|
| 192 |
+
</ul>
|
| 193 |
+
<p style="color:#c89a6c;font-size:11px;font-weight:700;margin-bottom:6px;text-align:left">You cannot:</p>
|
| 194 |
+
<ul
|
| 195 |
+
style="color:#a89f97;font-size:11px;line-height:1.9;padding-left:16px;list-style:disc;margin-bottom:16px;text-align:left">
|
| 196 |
+
<li>Commercially redistribute outputs or present them as your own product’s capability.</li>
|
| 197 |
+
<li>Reverse-engineer, extract, or attempt to replicate the underlying model or processing pipeline.</li>
|
| 198 |
+
<li>Use the platform for unlawful, harmful, or safety-critical operational purposes.</li>
|
| 199 |
+
<li>Misrepresent demo outputs as certified or regulatory-grade traffic data.</li>
|
| 200 |
+
</ul>
|
| 201 |
+
<p style="color:#a89f97;font-size:11px;text-align:left">This platform is provided as-is for <strong style="color:#f0ece6">demonstration and evaluation purposes only</strong>.
|
| 202 |
+
Outputs are not intended for operational, regulatory, or safety-critical use. This is an early-stage research project, not a commercial product.</p>
|
| 203 |
+
<p style="color:#555;font-size:10px;margin-top:16px;text-align:left">Questions: <strong
|
| 204 |
+
style="color:#c89a6c">support@urbanflow.in</strong></p>
|
| 205 |
+
</div>
|
| 206 |
+
</div>
|
| 207 |
|
| 208 |
<!-- Onboarding Walkthrough -->
|
| 209 |
<div id="onboard-overlay" class="onboard-overlay" style="display:none">
|