File size: 12,474 Bytes
4ed7d03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d9f53a4
 
 
 
 
 
4ed7d03
d9f53a4
 
4ed7d03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7a39572
4ed7d03
 
 
 
 
 
d9f53a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4ed7d03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dashboard - NETRA</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/dark-theme.css') }}">
    <style>
        .dashboard-card {
            transition: var(--transition);
        }

        .dashboard-card:hover {
            animation: slideInUp 0.3s ease;
        }
    </style>
</head>
<body>
    <!-- Toast Container -->
    <div id="toast-container"></div>

    <!-- Navigation Bar -->
    <nav class="navbar">
        <div class="nav-container">
            <div class="nav-brand">
                <span class="brand-icon">πŸ‘οΈ</span>
                <span>NETRA</span>
            </div>
            <button class="hamburger-menu" id="hamburger-toggle">
                <span></span>
                <span></span>
                <span></span>
            </button>
            <div class="nav-menu" id="nav-menu">
                <a href="{{ url_for('dashboard') }}" class="nav-link" style="opacity: 0.7;">Dashboard</a>
                <div class="dropdown" id="analysis-dropdown">
                    <button class="nav-link dropdown-btn" onclick="toggleDropdown(event)">πŸ“Š Analysis β–Ό</button>
                    <div class="dropdown-content">
                        <a href="{{ url_for('live_camera') }}" onclick="showLoadingToast()">πŸ“Ή Live Camera</a>
                        <a href="{{ url_for('video_analysis') }}" onclick="showLoadingToast()">πŸ“‹ Video Analysis</a>
                    </div>
                </div>
                <span class="user-greeting">πŸ‘‹ Welcome, {{ username }}!</span>
                <a href="{{ url_for('logout') }}" class="btn btn-outline">Logout</a>
            </div>
        </div>
    </nav>
    
    <div class="dashboard-container">
        <!-- Header with Animation -->
        <div class="dashboard-header reveal" style="animation: slideInDown 0.6s ease both;">
            <h1>πŸ“Š Video Surveillance Dashboard</h1>
            <p>Real-time threat detection and analysis</p>
        </div>

        <!-- System Status Cards -->
        <div class="info-section reveal" style="margin-bottom: 2rem;">
            <div class="info-card" style="animation: slideInUp 0.6s ease 0.1s both; animation-fill-mode: both;">
                <h3>βœ… System Health</h3>
                <p>All monitoring services are active and ready</p>
                <span class="status-chip ok">Operational</span>
            </div>
            <div class="info-card" style="animation: slideInUp 0.6s ease 0.2s both; animation-fill-mode: both;">
                <h3>⚑ Threat Engine</h3>
                <p>YOLO and weapon detection pipeline initialized</p>
                <span class="status-chip info">Realtime Enabled</span>
            </div>
            <div class="info-card" style="animation: slideInUp 0.6s ease 0.3s both; animation-fill-mode: both;">
                <h3>🚨 Incident Response</h3>
                <p>Critical events are prioritized with immediate alerts</p>
                <span class="status-chip warn">High Priority</span>
            </div>
        </div>
        
        <!-- Main Dashboard Cards -->
        <div class="dashboard-grid reveal">
            <!-- Live Camera Card -->
            <div class="dashboard-card" style="animation: slideInLeft 0.6s ease 0.2s both;">
                <div class="card-icon">
                    <svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="animation: slideInDown 0.5s ease;">
                        <path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"></path>
                        <circle cx="12" cy="13" r="4"></circle>
                    </svg>
                </div>
                <h2>Live Camera Feed</h2>
                <p>Monitor real-time camera feeds with advanced AI detection and instant alerts</p>
                <ul class="feature-list">
                    <li>🎯 Real-time object detection</li>
                    <li>⚠️ Violence & activity recognition</li>
                    <li>🚨 Instant alert notifications</li>
                    <li>πŸ€– Multi-model AI analysis</li>
                </ul>
                <a href="{{ url_for('live_camera') }}" class="btn btn-primary" style="width: 100%; margin-top: 1rem;" onclick="showLoadingToast()">▢️ Start Live Monitoring</a>
            </div>
            
            <!-- Video Analysis Card -->
            <div class="dashboard-card" style="animation: slideInRight 0.6s ease 0.2s both;">
                <div class="card-icon">
                    <svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="animation: slideInDown 0.5s ease;">
                        <polygon points="23 7 16 12 23 17 23 7"></polygon>
                        <rect x="1" y="5" width="15" height="14" rx="2" ry="2"></rect>
                    </svg>
                </div>
                <h2>Video Analysis</h2>
                <p>Upload and analyze pre-recorded video files with comprehensive detection reports</p>
                <ul class="feature-list">
                    <li>πŸ“ Upload video files (MP4, AVI, MOV)</li>
                    <li>πŸ” Frame-by-frame analysis</li>
                    <li>πŸ“ˆ Comprehensive detection reports</li>
                    <li>⏱️ Detection timeline visualization</li>
                </ul>
                <a href="{{ url_for('video_analysis') }}" class="btn btn-primary" style="width: 100%; margin-top: 1rem;" onclick="showLoadingToast()">πŸ“Ή Analyze Video</a>
            </div>
        </div>
        
        <!-- Available Models Section -->
        <div class="models-section reveal" style="animation: slideInUp 0.6s ease 0.4s both;">
            <h2>πŸ€– Active AI Models</h2>
            <div class="models-grid" id="models-container">
                <div class="model-badge" style="opacity: 0.6;">
                    <span class="spinner" style="width: 12px; height: 12px;"></span>
                    Loading models...
                </div>
            </div>
        </div>
        
        <!-- Features Section -->
        <div class="info-section reveal" style="animation: slideInUp 0.6s ease 0.5s both;">
            <div class="info-card">
                <h3>πŸ”’ Secure & Private</h3>
                <p>Your data is processed locally and securely stored with enterprise-grade encryption</p>
            </div>
            <div class="info-card">
                <h3>⚑ High Performance</h3>
                <p>Real-time processing with optimized GPU-accelerated AI models for instant analysis</p>
            </div>
            <div class="info-card">
                <h3>πŸ”§ Extensible</h3>
                <p>Easily integrate new detection models and customize for your specific needs</p>
            </div>
        </div>

        <!-- Statistics Section -->
        <div style="margin-top: 2rem; animation: slideInUp 0.6s ease 0.6s both;">
            <div style="border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--glass); backdrop-filter: blur(8px); padding: 1.5rem; text-align: center;">
                <h3 style="color: var(--blue-900); margin-bottom: 1rem;">Quick Stats</h3>
                <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem;">
                    <div>
                        <div style="font-size: 2rem; color: var(--blue-700); font-weight: 800;">4+</div>
                        <div style="color: var(--slate-700); font-size: 0.9rem;">Active AI Models</div>
                    </div>
                    <div>
                        <div style="font-size: 2rem; color: var(--blue-700); font-weight: 800;">99%+</div>
                        <div style="color: var(--slate-700); font-size: 0.9rem;">Detection Accuracy</div>
                    </div>
                    <div>
                        <div style="font-size: 2rem; color: var(--blue-700); font-weight: 800;">24/7</div>
                        <div style="color: var(--slate-700); font-size: 0.9rem;">Continuous Monitoring</div>
                    </div>
                    <div>
                        <div style="font-size: 2rem; color: var(--blue-700); font-weight: 800;">&lt;1s</div>
                        <div style="color: var(--slate-700); font-size: 0.9rem;">Detection Latency</div>
                    </div>
                </div>
            </div>
        </div>
        
    </div>

    <!-- Load UI Utilities -->
    <script src="{{ url_for('static', filename='js/ui-utils.js') }}"></script>
    
    <script>
        // Mobile menu toggle
        const hamburger = document.getElementById('hamburger-toggle');
        const navMenu = document.getElementById('nav-menu');
        
        if (hamburger) {
            hamburger.addEventListener('click', function(e) {
                e.stopPropagation();
                hamburger.classList.toggle('active');
                navMenu.classList.toggle('active');
            });
        }

        // Close menu when clicking on a link
        document.querySelectorAll('.nav-link, .nav-menu a').forEach(link => {
            link.addEventListener('click', function() {
                hamburger.classList.remove('active');
                navMenu.classList.remove('active');
            });
        });

        // Close menu when clicking outside
        document.addEventListener('click', function(e) {
            if (!e.target.closest('.nav-container')) {
                hamburger?.classList.remove('active');
                navMenu?.classList.remove('active');
            }
        });

        // Dropdown toggle for mobile
        function toggleDropdown(e) {
            e.preventDefault();
            const dropdown = e.target.closest('.dropdown');
            dropdown.classList.toggle('active');
        }

        // Show loading toast on navigation
        function showLoadingToast() {
            toast.info('πŸ”„ Loading...', 1500);
        }

        // Scroll animations
        const revealItems = document.querySelectorAll('.reveal');
        const io = new IntersectionObserver((entries) => {
            entries.forEach((entry) => {
                if (entry.isIntersecting) {
                    entry.target.style.opacity = '1';
                    entry.target.style.transform = 'translateY(0)';
                }
            });
        }, { threshold: 0.1 });

        revealItems.forEach((item) => {
            item.style.opacity = '0';
            item.style.transform = 'translateY(20px)';
            item.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
            io.observe(item);
        });

        // Load available models
        async function loadModels() {
            try {
                const response = await fetch('/api/models');
                const data = await response.json();
                const container = document.getElementById('models-container');
                
                if (data.models && data.models.length > 0) {
                    container.innerHTML = data.models.map((model, index) => 
                        `<div class="model-badge" style="animation: slideInRight 0.4s ease ${index * 0.1}s both;">
                            <span style="font-size: 1rem;">πŸ€–</span>
                            <span>${model}</span>
                        </div>`
                    ).join('');
                } else {
                    container.innerHTML = '<div class="model-badge">πŸ“¦ No models loaded</div>';
                }
            } catch (error) {
                console.error('Error loading models:', error);
                document.getElementById('models-container').innerHTML = 
                    '<div class="model-badge" style="color: var(--danger);">⚠️ Failed to load models</div>';
            }
        }

        // Load models on page ready
        if (document.readyState === 'loading') {
            document.addEventListener('DOMContentLoaded', loadModels);
        } else {
            loadModels();
        }

        // Log dashboard load
        console.log('βœ… Dashboard loaded successfully');
    </script>
</body>
</html>