Spaces:
Running
Running
Download index.html from rerisson2006/kks: direct link, hf CLI and curl.
- Browser
- Download file 11.1 kB
-
https://huggingface.co/spaces/rerisson2006/kks/resolve/main/index.html
- Command line
-
hf download hf://spaces/rerisson2006/kks/index.html
-
curl -L -o index.html https://huggingface.co/spaces/rerisson2006/kks/resolve/main/index.html
11.1 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Webcam Access</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| .camera-container { | |
| position: relative; | |
| width: 100%; | |
| max-width: 640px; | |
| margin: 0 auto; | |
| border-radius: 16px; | |
| overflow: hidden; | |
| box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); | |
| background: linear-gradient(145deg, #f0f0f0, #ffffff); | |
| } | |
| .video-placeholder { | |
| width: 100%; | |
| aspect-ratio: 16/9; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); | |
| color: #4b5563; | |
| } | |
| .video-element { | |
| width: 100%; | |
| height: auto; | |
| display: none; | |
| transform: scaleX(-1); /* Mirror effect */ | |
| } | |
| .controls { | |
| position: absolute; | |
| bottom: 20px; | |
| left: 0; | |
| right: 0; | |
| display: flex; | |
| justify-content: center; | |
| gap: 16px; | |
| z-index: 10; | |
| } | |
| .btn { | |
| padding: 12px 24px; | |
| border-radius: 50px; | |
| font-weight: 600; | |
| transition: all 0.3s ease; | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| } | |
| .btn-primary { | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| color: white; | |
| border: none; | |
| } | |
| .btn-primary:hover { | |
| transform: translateY(-2px); | |
| box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); | |
| } | |
| .btn-secondary { | |
| background: rgba(255, 255, 255, 0.9); | |
| color: #4b5563; | |
| border: 1px solid #e5e7eb; | |
| } | |
| .btn-secondary:hover { | |
| background: white; | |
| transform: translateY(-2px); | |
| } | |
| .permission-denied { | |
| display: none; | |
| text-align: center; | |
| padding: 20px; | |
| color: #ef4444; | |
| background-color: #fee2e2; | |
| border-radius: 8px; | |
| margin-top: 20px; | |
| } | |
| .loading { | |
| display: none; | |
| flex-direction: column; | |
| align-items: center; | |
| gap: 16px; | |
| } | |
| .spinner { | |
| width: 40px; | |
| height: 40px; | |
| border: 4px solid rgba(0, 0, 0, 0.1); | |
| border-radius: 50%; | |
| border-left-color: #764ba2; | |
| animation: spin 1s linear infinite; | |
| } | |
| @keyframes spin { | |
| to { transform: rotate(360deg); } | |
| } | |
| .status { | |
| margin-top: 20px; | |
| padding: 10px; | |
| border-radius: 8px; | |
| text-align: center; | |
| display: none; | |
| } | |
| .success { | |
| background-color: #dcfce7; | |
| color: #166534; | |
| } | |
| .error { | |
| background-color: #fee2e2; | |
| color: #991b1b; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50 min-h-screen flex flex-col items-center justify-center p-4"> | |
| <div class="max-w-2xl w-full space-y-8"> | |
| <div class="text-center"> | |
| <h1 class="text-3xl font-bold text-gray-900 mb-2">Webcam Access</h1> | |
| <p class="text-gray-600">Click the button below to start your camera</p> | |
| </div> | |
| <div class="camera-container"> | |
| <div class="video-placeholder" id="placeholder"> | |
| <div class="text-center p-6"> | |
| <i class="fas fa-camera text-4xl mb-4 text-gray-400"></i> | |
| <p class="text-lg font-medium">Camera feed will appear here</p> | |
| <p class="text-sm text-gray-500 mt-2">Click "Start Camera" to begin</p> | |
| </div> | |
| </div> | |
| <video id="video" class="video-element" autoplay playsinline></video> | |
| <div class="controls"> | |
| <button id="startBtn" class="btn btn-primary"> | |
| <i class="fas fa-play"></i> Start Camera | |
| </button> | |
| <button id="stopBtn" class="btn btn-secondary" disabled> | |
| <i class="fas fa-stop"></i> Stop | |
| </button> | |
| </div> | |
| </div> | |
| <div id="loading" class="loading"> | |
| <div class="spinner"></div> | |
| <p>Accessing your camera...</p> | |
| </div> | |
| <div id="permissionDenied" class="permission-denied"> | |
| <i class="fas fa-exclamation-triangle text-2xl mb-2"></i> | |
| <p>Camera access was denied. Please refresh and allow camera permissions.</p> | |
| </div> | |
| <div id="statusMessage" class="status"> | |
| <!-- Status messages will appear here --> | |
| </div> | |
| <div class="mt-8 bg-white p-6 rounded-xl shadow-sm border border-gray-200"> | |
| <h2 class="text-xl font-semibold mb-4 text-gray-800">Privacy Notice</h2> | |
| <p class="text-gray-600 mb-4"> | |
| This application requires camera access to function properly. Your video feed is processed locally in your browser and is not stored or transmitted to any servers. | |
| </p> | |
| <div class="flex items-center text-sm text-gray-500"> | |
| <i class="fas fa-lock mr-2"></i> | |
| <span>Your privacy is important to us. Camera access is used solely for this session.</span> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const video = document.getElementById('video'); | |
| const startBtn = document.getElementById('startBtn'); | |
| const stopBtn = document.getElementById('stopBtn'); | |
| const placeholder = document.getElementById('placeholder'); | |
| const loading = document.getElementById('loading'); | |
| const permissionDenied = document.getElementById('permissionDenied'); | |
| const statusMessage = document.getElementById('statusMessage'); | |
| let stream = null; | |
| // Function to start the camera | |
| async function startCamera() { | |
| try { | |
| // Show loading state | |
| startBtn.disabled = true; | |
| placeholder.style.display = 'none'; | |
| loading.style.display = 'flex'; | |
| permissionDenied.style.display = 'none'; | |
| // Request camera access | |
| stream = await navigator.mediaDevices.getUserMedia({ | |
| video: { | |
| width: { ideal: 1280 }, | |
| height: { ideal: 720 }, | |
| facingMode: 'user' | |
| }, | |
| audio: false | |
| }); | |
| // Display the video stream | |
| video.srcObject = stream; | |
| video.style.display = 'block'; | |
| // Hide loading and show success | |
| loading.style.display = 'none'; | |
| stopBtn.disabled = false; | |
| // Show status message | |
| showStatus('Camera access granted!', 'success'); | |
| } catch (err) { | |
| console.error('Error accessing camera:', err); | |
| // Show appropriate error message | |
| loading.style.display = 'none'; | |
| startBtn.disabled = false; | |
| if (err.name === 'NotAllowedError') { | |
| permissionDenied.style.display = 'block'; | |
| showStatus('Camera access was denied.', 'error'); | |
| } else if (err.name === 'NotFoundError') { | |
| showStatus('No camera device found.', 'error'); | |
| } else { | |
| showStatus('Error accessing camera: ' + err.message, 'error'); | |
| } | |
| // Show placeholder again | |
| placeholder.style.display = 'flex'; | |
| } | |
| } | |
| // Function to stop the camera | |
| function stopCamera() { | |
| if (stream) { | |
| const tracks = stream.getTracks(); | |
| tracks.forEach(track => track.stop()); | |
| video.srcObject = null; | |
| stream = null; | |
| // Reset UI | |
| video.style.display = 'none'; | |
| placeholder.style.display = 'flex'; | |
| startBtn.disabled = false; | |
| stopBtn.disabled = true; | |
| showStatus('Camera stopped.', 'success'); | |
| } | |
| } | |
| // Function to show status messages | |
| function showStatus(message, type) { | |
| statusMessage.textContent = message; | |
| statusMessage.className = 'status ' + type; | |
| statusMessage.style.display = 'block'; | |
| // Hide after 5 seconds | |
| setTimeout(() => { | |
| statusMessage.style.display = 'none'; | |
| }, 5000); | |
| } | |
| // Event listeners | |
| startBtn.addEventListener('click', startCamera); | |
| stopBtn.addEventListener('click', stopCamera); | |
| // Check if browser supports mediaDevices | |
| if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) { | |
| startBtn.disabled = true; | |
| showStatus('Your browser does not support camera access.', 'error'); | |
| } | |
| }); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=rerisson2006/kks" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |