Spaces:
Sleeping
Sleeping
Download src/ClipForge.Api/wwwroot/index.html from clipeforge/app: direct link, hf CLI and curl.
- Browser
- Download file 14.8 kB
-
https://huggingface.co/spaces/clipeforge/app/resolve/main/src/ClipForge.Api/wwwroot/index.html
- Command line
-
hf download hf://spaces/clipeforge/app/src/ClipForge.Api/wwwroot/index.html
-
curl -L -o index.html https://huggingface.co/spaces/clipeforge/app/resolve/main/src/ClipForge.Api/wwwroot/index.html
14.8 kB
| <html lang="pt-BR"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>ClipForge - Gerador de Vídeos</title> | |
| <style> | |
| * { margin: 0; padding: 0; box-sizing: border-box; } | |
| body { | |
| font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; | |
| background: #0f0f0f; | |
| color: #fff; | |
| min-height: 100vh; | |
| padding: 20px; | |
| } | |
| .container { max-width: 600px; margin: 0 auto; } | |
| h1 { | |
| text-align: center; | |
| font-size: 2rem; | |
| margin-bottom: 8px; | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| -webkit-background-clip: text; | |
| -webkit-text-fill-color: transparent; | |
| } | |
| .subtitle { text-align: center; color: #888; margin-bottom: 30px; font-size: 0.9rem; } | |
| .card { | |
| background: #1a1a2e; | |
| border-radius: 16px; | |
| padding: 24px; | |
| margin-bottom: 20px; | |
| border: 1px solid #2a2a4a; | |
| } | |
| .form-group { margin-bottom: 16px; } | |
| label { display: block; margin-bottom: 6px; color: #aaa; font-size: 0.85rem; } | |
| input, select { | |
| width: 100%; | |
| padding: 14px 16px; | |
| border-radius: 10px; | |
| border: 1px solid #333; | |
| background: #0f0f1a; | |
| color: #fff; | |
| font-size: 1rem; | |
| } | |
| input:focus, select:focus { outline: none; border-color: #667eea; } | |
| .btn { | |
| width: 100%; | |
| padding: 16px; | |
| border: none; | |
| border-radius: 12px; | |
| font-size: 1.1rem; | |
| font-weight: 600; | |
| cursor: pointer; | |
| transition: all 0.3s; | |
| } | |
| .btn-primary { | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| color: #fff; | |
| } | |
| .btn-primary:hover { transform: scale(1.02); opacity: 0.9; } | |
| .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; } | |
| .status { | |
| text-align: center; | |
| padding: 16px; | |
| border-radius: 10px; | |
| margin-top: 16px; | |
| display: none; | |
| } | |
| .status.loading { display: block; background: #1a1a3e; color: #667eea; } | |
| .status.success { display: block; background: #1a3e1a; color: #4ade80; } | |
| .status.error { display: block; background: #3e1a1a; color: #f87171; } | |
| .spinner { | |
| display: inline-block; | |
| width: 20px; height: 20px; | |
| border: 3px solid #667eea; | |
| border-top-color: transparent; | |
| border-radius: 50%; | |
| animation: spin 1s linear infinite; | |
| margin-right: 8px; | |
| vertical-align: middle; | |
| } | |
| @keyframes spin { to { transform: rotate(360deg); } } | |
| .videos-section { margin-top: 30px; } | |
| .videos-section h2 { font-size: 1.3rem; margin-bottom: 16px; color: #ccc; } | |
| .video-item { | |
| background: #1a1a2e; | |
| border-radius: 12px; | |
| padding: 16px; | |
| margin-bottom: 12px; | |
| border: 1px solid #2a2a4a; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| gap: 12px; | |
| } | |
| .video-info { flex: 1; } | |
| .video-info .title { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; } | |
| .video-info .meta { color: #888; font-size: 0.8rem; } | |
| .btn-download { | |
| padding: 10px 16px; | |
| border-radius: 8px; | |
| background: #667eea; | |
| color: #fff; | |
| text-decoration: none; | |
| font-size: 0.85rem; | |
| font-weight: 600; | |
| white-space: nowrap; | |
| } | |
| .btn-download:hover { opacity: 0.8; } | |
| .btn-delete { | |
| padding: 10px 12px; | |
| border-radius: 8px; | |
| background: #dc2626; | |
| color: #fff; | |
| border: none; | |
| font-size: 0.85rem; | |
| cursor: pointer; | |
| white-space: nowrap; | |
| } | |
| .btn-delete:hover { opacity: 0.8; } | |
| .btn-clear { | |
| width: 100%; | |
| padding: 12px; | |
| margin-top: 16px; | |
| border-radius: 10px; | |
| background: #333; | |
| color: #888; | |
| border: 1px solid #444; | |
| font-size: 0.85rem; | |
| cursor: pointer; | |
| } | |
| .btn-clear:hover { background: #dc2626; color: #fff; border-color: #dc2626; } | |
| .empty { text-align: center; color: #555; padding: 20px; } | |
| .hidden { display: none; } | |
| .login-card { text-align: center; margin-top: 20vh; } | |
| .login-card h1 { margin-bottom: 20px; } | |
| .login-error { color: #f87171; margin-top: 10px; display: none; } | |
| </style> | |
| </head> | |
| <body> | |
| <!-- LOGIN SCREEN --> | |
| <div class="container" id="loginScreen"> | |
| <div class="card login-card"> | |
| <h1>🔒 ClipForge</h1> | |
| <p class="subtitle">Digite a senha para acessar</p> | |
| <div class="form-group"> | |
| <input type="password" id="passwordInput" placeholder="Senha" onkeypress="if(event.key==='Enter')login()" /> | |
| </div> | |
| <button class="btn btn-primary" onclick="login()">Entrar</button> | |
| <p class="login-error" id="loginError">Senha incorreta</p> | |
| </div> | |
| </div> | |
| <!-- MAIN APP --> | |
| <div class="container hidden" id="mainApp"> | |
| <h1>🎬 ClipForge</h1> | |
| <p class="subtitle">Gerador automático de vídeos virais com IA</p> | |
| <div class="card"> | |
| <div class="form-group"> | |
| <label>Tema do vídeo</label> | |
| <input type="text" id="niche" placeholder="Ex: curiosidades do filme do Michael Jackson 2025" /> | |
| </div> | |
| <div class="form-group"> | |
| <label>Plataforma</label> | |
| <select id="platform"> | |
| <option value="tiktok">TikTok</option> | |
| <option value="youtube_shorts">YouTube Shorts</option> | |
| <option value="kwai">Kwai</option> | |
| </select> | |
| </div> | |
| <div class="form-group"> | |
| <label>Voz</label> | |
| <select id="voice"> | |
| <option value="francisca">Francisca (feminina)</option> | |
| <option value="antonio">Antonio (masculina)</option> | |
| <option value="thalita">Thalita (jovem)</option> | |
| </select> | |
| </div> | |
| <button class="btn btn-primary" id="generateBtn" onclick="generate()">🚀 Gerar Vídeo</button> | |
| <div class="status" id="status"></div> | |
| </div> | |
| <div class="videos-section"> | |
| <h2>📁 Vídeos Gerados</h2> | |
| <div id="videosList"><div class="empty">Carregando...</div></div> | |
| <button class="btn-clear" onclick="clearAll()">🧹 Limpar tudo</button> | |
| </div> | |
| </div> | |
| <script> | |
| const API = window.location.origin; | |
| async function login() { | |
| const pass = document.getElementById('passwordInput').value; | |
| if (pass === atob('Q2xpcEZvcmdlQDIwMjUh')) { | |
| sessionStorage.setItem('auth', '1'); | |
| document.getElementById('loginScreen').classList.add('hidden'); | |
| document.getElementById('mainApp').classList.remove('hidden'); | |
| loadVideos(); | |
| } else { | |
| document.getElementById('loginError').style.display = 'block'; | |
| } | |
| } | |
| // Check if already logged in | |
| if (sessionStorage.getItem('auth') === '1') { | |
| document.getElementById('loginScreen').classList.add('hidden'); | |
| document.getElementById('mainApp').classList.remove('hidden'); | |
| loadVideos(); | |
| } | |
| async function deleteVideo(id) { | |
| if (!confirm('Apagar este vídeo e todos os dados relacionados?')) return; | |
| try { | |
| const res = await fetch(`${API}/api/videos/${id}`, { method: 'DELETE' }); | |
| if (res.ok) { loadVideos(); } | |
| else { alert('Erro ao apagar'); } | |
| } catch (e) { alert('Erro: ' + e.message); } | |
| } | |
| async function clearAll() { | |
| if (!confirm('Apagar TODOS os vídeos e limpar o banco? Isso não pode ser desfeito.')) return; | |
| try { | |
| const res = await fetch(`${API}/api/admin/clear-all`, { method: 'DELETE' }); | |
| if (res.ok) { loadVideos(); alert('Tudo limpo!'); } | |
| else { alert('Erro ao limpar'); } | |
| } catch (e) { alert('Erro: ' + e.message); } | |
| } | |
| async function generate() { | |
| const niche = document.getElementById('niche').value.trim(); | |
| if (!niche) { alert('Digite um tema!'); return; } | |
| const platform = document.getElementById('platform').value; | |
| const voice = document.getElementById('voice').value; | |
| const btn = document.getElementById('generateBtn'); | |
| const status = document.getElementById('status'); | |
| btn.disabled = true; | |
| status.className = 'status loading'; | |
| status.innerHTML = '<span class="spinner"></span> 🚀 Enviando para geração...'; | |
| try { | |
| // Dispara em background - não espera terminar | |
| const res = await fetch(`${API}/api/pipeline/run`, { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ niche, platform }) | |
| }); | |
| if (res.ok) { | |
| status.className = 'status loading'; | |
| startProgressAnimation(); | |
| startPolling(); | |
| } else { | |
| const err = await res.text(); | |
| status.className = 'status error'; | |
| status.textContent = '❌ Erro: ' + err.substring(0, 150); | |
| btn.disabled = false; | |
| } | |
| } catch (e) { | |
| status.className = 'status error'; | |
| status.textContent = '❌ Erro de conexão: ' + e.message; | |
| btn.disabled = false; | |
| } | |
| } | |
| let pollingInterval = null; | |
| let progressInterval = null; | |
| let lastVideoCount = 0; | |
| function startProgressAnimation() { | |
| const status = document.getElementById('status'); | |
| const steps = [ | |
| { text: '🧠 Gerando ideia viral...', time: 0 }, | |
| { text: '📝 Escrevendo roteiro com IA...', time: 8 }, | |
| { text: '🎙️ Gerando narração em português...', time: 15 }, | |
| { text: '🎬 Baixando clips do YouTube...', time: 25 }, | |
| { text: '🎬 Baixando mais clips...', time: 60 }, | |
| { text: '🎞️ Montando vídeo vertical...', time: 120 }, | |
| { text: '💬 Adicionando legendas...', time: 180 }, | |
| { text: '✨ Finalizando exportação...', time: 220 }, | |
| { text: '⏳ Quase lá... processando...', time: 260 } | |
| ]; | |
| let startTime = Date.now(); | |
| if (progressInterval) clearInterval(progressInterval); | |
| progressInterval = setInterval(() => { | |
| const elapsed = (Date.now() - startTime) / 1000; | |
| let currentStep = steps[0]; | |
| for (const step of steps) { | |
| if (elapsed >= step.time) currentStep = step; | |
| } | |
| const minutes = Math.floor(elapsed / 60); | |
| const seconds = Math.floor(elapsed % 60); | |
| const timeStr = minutes > 0 ? `${minutes}m${seconds}s` : `${seconds}s`; | |
| status.innerHTML = `<span class="spinner"></span> ${currentStep.text}<br><small style="color:#888">Tempo: ${timeStr} • Pode fechar e voltar depois</small>`; | |
| }, 1000); | |
| } | |
| function startPolling() { | |
| if (pollingInterval) clearInterval(pollingInterval); | |
| pollingInterval = setInterval(async () => { | |
| try { | |
| const res = await fetch(`${API}/api/videos/status/completed`); | |
| const videos = await res.json(); | |
| const completedCount = videos.filter(v => v.fileSizeBytes > 0).length; | |
| if (completedCount > lastVideoCount) { | |
| lastVideoCount = completedCount; | |
| clearInterval(pollingInterval); | |
| clearInterval(progressInterval); | |
| pollingInterval = null; | |
| progressInterval = null; | |
| document.getElementById('status').className = 'status success'; | |
| document.getElementById('status').textContent = '✅ Vídeo gerado com sucesso!'; | |
| document.getElementById('generateBtn').disabled = false; | |
| loadVideos(); | |
| } | |
| } catch (e) { /* ignore */ } | |
| }, 20000); | |
| } | |
| async function loadVideos() { | |
| try { | |
| const res = await fetch(`${API}/api/videos`); | |
| const videos = await res.json(); | |
| const list = document.getElementById('videosList'); | |
| lastVideoCount = videos.filter(v => v.fileSizeBytes > 0 && v.status === 'completed').length; | |
| const validVideos = videos.filter(v => v.fileSizeBytes > 0); | |
| if (validVideos.length === 0) { | |
| list.innerHTML = '<div class="empty">Nenhum vídeo gerado ainda</div>'; | |
| return; | |
| } | |
| list.innerHTML = validVideos.map(v => ` | |
| <div class="video-item"> | |
| <div class="video-info"> | |
| <div class="title">🎬 Vídeo ${v.id.substring(0, 8)}</div> | |
| <div class="meta">${Math.round(v.durationSeconds)}s • ${(v.fileSizeBytes / 1024 / 1024).toFixed(1)} MB • ${new Date(v.createdAt).toLocaleString('pt-BR')}</div> | |
| </div> | |
| <a class="btn-download" href="${API}/api/videos/${v.id}/download" download>⬇ Baixar</a> | |
| <button class="btn-delete" onclick="deleteVideo('${v.id}')">🗑</button> | |
| </div> | |
| `).join(''); | |
| } catch (e) { | |
| document.getElementById('videosList').innerHTML = '<div class="empty">Erro ao carregar vídeos</div>'; | |
| } | |
| } | |
| </script> | |
| </body> | |
| </html> | |