Spaces:
Runtime error
Runtime error
Download frontend/dashboard.html from BugHu/voice-detector: direct link, hf CLI and curl.
- Browser
- Download file 14.6 kB
-
https://huggingface.co/spaces/BugHu/voice-detector/resolve/main/frontend/dashboard.html
- Command line
-
hf download hf://spaces/BugHu/voice-detector/frontend/dashboard.html
-
curl -L -o dashboard.html https://huggingface.co/spaces/BugHu/voice-detector/resolve/main/frontend/dashboard.html
14.6 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Dashboard - AI Voice Detection</title> | |
| <link rel="stylesheet" href="styles.css?v=5"> | |
| <script src="theme.js?v=4"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js"></script> | |
| <style> | |
| .dashboard-container { | |
| max-width: 1000px; | |
| margin: 40px auto; | |
| padding: 20px; | |
| } | |
| .welcome-banner { | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| color: white; | |
| padding: 30px; | |
| border-radius: 12px; | |
| margin-bottom: 30px; | |
| box-shadow: 0 10px 20px rgba(102, 126, 234, 0.2); | |
| position: relative; | |
| overflow: hidden; | |
| } | |
| .welcome-content h1 { | |
| font-size: 28px; | |
| margin-bottom: 8px; | |
| } | |
| .api-key-box { | |
| background: rgba(255, 255, 255, 0.15); | |
| padding: 10px 15px; | |
| border-radius: 6px; | |
| display: inline-flex; | |
| align-items: center; | |
| margin-top: 15px; | |
| backdrop-filter: blur(5px); | |
| } | |
| .api-key-label { | |
| font-weight: 600; | |
| margin-right: 10px; | |
| font-size: 14px; | |
| opacity: 0.9; | |
| } | |
| .api-key-value { | |
| font-family: monospace; | |
| margin-right: 10px; | |
| font-size: 15px; | |
| letter-spacing: 1px; | |
| } | |
| .copy-btn { | |
| background: transparent; | |
| border: 1px solid rgba(255, 255, 255, 0.4); | |
| color: white; | |
| width: 30px; | |
| height: 30px; | |
| border-radius: 4px; | |
| cursor: pointer; | |
| transition: all 0.2s; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| } | |
| .copy-btn:hover { | |
| background: rgba(255, 255, 255, 0.2); | |
| } | |
| .stats-grid { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); | |
| gap: 20px; | |
| margin-bottom: 30px; | |
| } | |
| .stat-card { | |
| background: white; | |
| padding: 20px; | |
| border-radius: 12px; | |
| box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); | |
| border: 1px solid #f0f0f0; | |
| transition: transform 0.3s ease; | |
| } | |
| .stat-card:hover { | |
| transform: translateY(-5px); | |
| } | |
| .stat-title { | |
| color: #666; | |
| font-size: 14px; | |
| font-weight: 500; | |
| margin-bottom: 8px; | |
| display: flex; | |
| align-items: center; | |
| } | |
| .stat-title i { | |
| margin-right: 8px; | |
| color: #764ba2; | |
| } | |
| .stat-value { | |
| font-size: 28px; | |
| font-weight: 700; | |
| color: #333; | |
| } | |
| .stat-trend { | |
| font-size: 13px; | |
| margin-top: 5px; | |
| } | |
| .trend-up { | |
| color: #4caf50; | |
| } | |
| .trend-down { | |
| color: #f44336; | |
| } | |
| .trend-stable { | |
| color: #ff9800; | |
| } | |
| .action-grid { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); | |
| gap: 20px; | |
| } | |
| .action-card { | |
| background: white; | |
| padding: 30px; | |
| border-radius: 12px; | |
| text-align: center; | |
| box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); | |
| border: 1px solid #f0f0f0; | |
| } | |
| .action-icon { | |
| width: 60px; | |
| height: 60px; | |
| background: #f3f4fa; | |
| border-radius: 50%; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| margin: 0 auto 20px; | |
| font-size: 24px; | |
| color: #667eea; | |
| } | |
| .action-title { | |
| font-size: 18px; | |
| font-weight: 600; | |
| margin-bottom: 10px; | |
| color: #333; | |
| } | |
| .action-desc { | |
| color: #666; | |
| margin-bottom: 20px; | |
| font-size: 14px; | |
| } | |
| .nav-header { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| margin-bottom: 20px; | |
| } | |
| .logout-btn { | |
| background: transparent; | |
| border: 1px solid #ff5252; | |
| color: #ff5252; | |
| padding: 8px 16px; | |
| border-radius: 6px; | |
| cursor: pointer; | |
| transition: all 0.2s; | |
| font-weight: 500; | |
| } | |
| .logout-btn:hover { | |
| background: #ff5252; | |
| color: white; | |
| } | |
| .loading-screen { | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| background: white; | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| justify-content: center; | |
| z-index: 1000; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div id="loading" class="loading-screen"> | |
| <div class="spinner"></div> | |
| <p style="margin-top: 20px; color: #666;">Loading your dashboard...</p> | |
| </div> | |
| <div class="dashboard-container fade-in" id="dashboardContent" style="display: none;"> | |
| <div class="nav-header"> | |
| <a href="index.html" | |
| style="text-decoration: none; font-weight: 700; color: var(--text-color); font-size: 20px;"> | |
| <i class="fas fa-wave-square" style="color: #667eea; margin-right: 8px;"></i>AI Voice Detector | |
| </a> | |
| <div style="display: flex; align-items: center; gap: 15px;"> | |
| <button id="themeToggle" class="theme-toggle" aria-label="Toggle Theme"> | |
| <i class="fas fa-moon"></i> | |
| </button> | |
| <button class="logout-btn" id="logoutBtn"> | |
| <i class="fas fa-sign-out-alt"></i> Logout | |
| </button> | |
| </div> | |
| </div> | |
| <div class="welcome-banner"> | |
| <div class="welcome-content"> | |
| <h1 id="welcomeText">Welcome back!</h1> | |
| <p>Here's an overview of your voice detection activities</p> | |
| <div class="api-key-box"> | |
| <span class="api-key-label">API Key:</span> | |
| <span class="api-key-value" id="apiKeyDisplay">Loading...</span> | |
| <button class="copy-btn" id="copyBtn" title="Copy API Key"> | |
| <i class="fas fa-copy"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="stats-grid"> | |
| <div class="stat-card"> | |
| <div class="stat-title"><i class="fas fa-chart-line"></i> Total Tests</div> | |
| <div class="stat-value" id="totalTests">--</div> | |
| </div> | |
| <div class="stat-card"> | |
| <div class="stat-title"><i class="fas fa-robot"></i> AI Detected</div> | |
| <div class="stat-value" id="aiCount">--</div> | |
| </div> | |
| <div class="stat-card"> | |
| <div class="stat-title"><i class="fas fa-user"></i> Human Verified</div> | |
| <div class="stat-value" id="humanCount">--</div> | |
| </div> | |
| <div class="stat-card"> | |
| <div class="stat-title"><i class="fas fa-percentage"></i> Avg Confidence</div> | |
| <div class="stat-value" id="avgConfidence">--%</div> | |
| <div class="stat-trend" id="trendDisplay"> | |
| <span class="trend-stable"><i class="fas fa-minus"></i> Stable trend</span> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="stats-grid" style="grid-template-columns: 1fr 1fr;"> | |
| <div class="stat-card"> | |
| <div class="stat-title"><i class="fas fa-calendar-day"></i> Requests Today</div> | |
| <div class="stat-value" id="requestsToday">--</div> | |
| </div> | |
| <div class="stat-card"> | |
| <div class="stat-title"><i class="fas fa-server"></i> Total API Usage</div> | |
| <div class="stat-value" id="totalRequests">--</div> | |
| </div> | |
| </div> | |
| <div class="action-grid"> | |
| <div class="action-card card-hover"> | |
| <div class="action-icon"> | |
| <i class="fas fa-microphone-alt"></i> | |
| </div> | |
| <h3 class="action-title">New Analysis</h3> | |
| <p class="action-desc">Upload audio file to detect AI-generated voice</p> | |
| <a href="upload.html" class="btn btn-primary" | |
| style="text-decoration: none; padding: 10px 24px; background: #667eea; color: white; border-radius: 6px;"> | |
| Start Detection | |
| </a> | |
| </div> | |
| <div class="action-card card-hover"> | |
| <div class="action-icon"> | |
| <i class="fas fa-history"></i> | |
| </div> | |
| <h3 class="action-title">History</h3> | |
| <p class="action-desc">View your past prediction results and details</p> | |
| <a href="history.html" class="btn btn-outline" | |
| style="text-decoration: none; padding: 10px 24px; border: 2px solid #667eea; color: #667eea; border-radius: 6px; font-weight: 600;"> | |
| View History | |
| </a> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| const API_URL = ''; | |
| // Check authentication | |
| const token = localStorage.getItem('access_token'); | |
| if (!token) { | |
| window.location.href = 'login.html'; | |
| } | |
| // Logout functionality | |
| document.getElementById('logoutBtn').addEventListener('click', () => { | |
| localStorage.removeItem('access_token'); | |
| localStorage.removeItem('user_email'); | |
| localStorage.removeItem('api_key'); | |
| window.location.href = 'index.html'; | |
| }); | |
| // Copy API key | |
| const copyBtn = document.getElementById('copyBtn'); | |
| const apiKeyDisplay = document.getElementById('apiKeyDisplay'); | |
| copyBtn.addEventListener('click', () => { | |
| const apiKey = apiKeyDisplay.textContent; | |
| navigator.clipboard.writeText(apiKey).then(() => { | |
| const originalIcon = copyBtn.innerHTML; | |
| copyBtn.innerHTML = '<i class="fas fa-check"></i>'; | |
| setTimeout(() => { | |
| copyBtn.innerHTML = originalIcon; | |
| }, 2000); | |
| }); | |
| }); | |
| // Fetch dashboard statistics | |
| async function fetchStats() { | |
| try { | |
| const response = await fetch(`${API_URL}dashboard/stats`, { | |
| headers: { | |
| 'Authorization': `Bearer ${token}` | |
| } | |
| }); | |
| if (response.status === 401) { | |
| // Token expired | |
| localStorage.removeItem('access_token'); | |
| window.location.href = 'login.html'; | |
| return; | |
| } | |
| if (!response.ok) throw new Error('Failed to fetch stats'); | |
| const data = await response.json(); | |
| // Update UI | |
| document.getElementById('welcomeText').textContent = `Welcome back, ${localStorage.getItem('user_email').split('@')[0]}!`; | |
| document.getElementById('apiKeyDisplay').textContent = data.api_key; | |
| document.getElementById('totalTests').textContent = data.total_tests; | |
| document.getElementById('aiCount').textContent = data.ai_count; | |
| document.getElementById('humanCount').textContent = data.human_count; | |
| document.getElementById('avgConfidence').textContent = `${(data.avg_confidence * 100).toFixed(1)}%`; | |
| document.getElementById('requestsToday').textContent = data.requests_today; | |
| document.getElementById('totalRequests').textContent = data.total_requests; | |
| // Update trend | |
| const trendEl = document.getElementById('trendDisplay'); | |
| if (data.trend === 'Improving') { | |
| trendEl.innerHTML = '<span class="trend-up"><i class="fas fa-arrow-up"></i> Improving confidence</span>'; | |
| } else if (data.trend === 'Declining') { | |
| trendEl.innerHTML = '<span class="trend-down"><i class="fas fa-arrow-down"></i> Declining confidence</span>'; | |
| } else { | |
| trendEl.innerHTML = '<span class="trend-stable"><i class="fas fa-minus"></i> Stable trend</span>'; | |
| } | |
| // Show dashboard | |
| document.getElementById('loading').style.display = 'none'; | |
| document.getElementById('dashboardContent').style.display = 'block'; | |
| } catch (error) { | |
| console.error('Error:', error); | |
| alert('Failed to load dashboard data. Please try again.'); | |
| } | |
| } | |
| // Initialize | |
| fetchStats(); | |
| </script> | |
| <!-- Team Footer --> | |
| <footer class="team-footer"> | |
| <div class="footer-divider"></div> | |
| <div class="footer-content"> | |
| <h2 class="team-name">Bug Hunterx</h2> | |
| <h3>Built by</h3> | |
| <div class="team-members"> | |
| <div class="member"> | |
| <span class="name">Mohammed Meraj Uddin</span> | |
| <a href="https://www.linkedin.com/in/merajuddin-0751a6396" target="_blank" | |
| aria-label="LinkedIn for Mohammed Meraj Uddin"> | |
| <i class="fab fa-linkedin"></i> | |
| </a> | |
| </div> | |
| <div class="member"> | |
| <span class="name">Mohd Basheer Ahmed</span> | |
| <a href="https://www.linkedin.com/in/mohd-basheer-ahmed-5247593a6" target="_blank" | |
| aria-label="LinkedIn for Mohd Basheer Ahmed"> | |
| <i class="fab fa-linkedin"></i> | |
| </a> | |
| </div> | |
| </div> | |
| <p class="footer-note">Responsive UI • Optimized for all screen sizes</p> | |
| </div> | |
| </footer> | |
| </body> | |
| </html> |