Update templates/index.html
Browse files2 unmodified lines34567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391402 unmodified lines<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>VibeSync AI | Professional Music Tool</title><style>body { background: #000; color: #fff; font-family: 'Segoe UI', sans-serif; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; }.container { background: #0a0a0a; border: 2px solid #00f2ea; padding: 40px; border-radius: 25px; width: 90%; max-width: 420px; text-align: center; box-shadow: 0 0 30px rgba(0, 242, 234, 0.3); }h1 { font-size: 32px; letter-spacing: 4px; margin-bottom: 5px; }h1 span { color: #ff0050; }.input-group { margin-bottom: 20px; text-align: left; }label { font-size: 11px; color: #00f2ea; text-transform: uppercase; letter-spacing: 1px; }input, select { width: 100%; padding: 15px; margin-top: 8px; background: #111; border: 1px solid #333; color: #fff; border-radius: 12px; box-sizing: border-box; }.btn { background: linear-gradient(45deg, #00f2ea, #ff0050); border: none; padding: 18px; border-radius: 12px; width: 100%; font-weight: bold; color: #fff; cursor: pointer; transition: 0.3s; font-size: 16px; margin-top: 10px; }.btn:disabled { opacity: 0.4; cursor: not-allowed; }.progress-box { display: none; margin-top: 30px; }.bar-container { background: #222; height: 12px; border-radius: 6px; margin: 15px 0; overflow: hidden; border: 1px solid #333; }.bar { background: linear-gradient(90deg, #00f2ea, #ff0050); width: 0%; height: 100%; transition: 0.5s; box-shadow: 0 0 15px #00f2ea; }#status-text { font-size: 14px; color: #ff0050; font-weight: bold; }#download-btn { display: none; background: #238636; text-decoration: none; display: none; justify-content: center; align-items: center; }</style></head><body><div class="container"><h1>VIBE<span>SYNC</span></h1><p style="font-size: 11px; color: #555; margin-bottom: 30px;">PREMIUM BEAT VISUALIZER AI</p><form id="uploadForm"><div class="input-group"><label>Select Audio File</label><input type="file" id="audioInput" accept="audio/*" required></div><div class="input-group"><label>Output Format</label><select id="sizeInput"><option value="9:16">Portrait (9:16) - Reels/Shorts</option><option value="16:9">Landscape (16:9) - YouTube</option></select></div><button type="submit" id="startBtn" class="btn">GENERATE PRO VIDEO 🚀</button></form><div class="progress-box" id="progressBox"><p id="status-text">Uploading...</p><div class="bar-container"><div class="bar" id="progressBar"></div></div><p id="percentText" style="font-size: 12px; color: #00f2ea;">0%</p></div><a id="download-btn" class="btn">DOWNLOAD VIDEO 📥</a></div><script>const form = document.getElementById('uploadForm');const startBtn = document.getElementById('startBtn');const progressBox = document.getElementById('progressBox');const progressBar = document.getElementById('progressBar');const statusText = document.getElementById('status-text');const percentText = document.getElementById('percentText');const downloadBtn = document.getElementById('download-btn');form.onsubmit = async (e) => {e.preventDefault();// UI SetupstartBtn.disabled = true;document.getElementById('audioInput').disabled = true;document.getElementById('sizeInput').disabled = true;progressBox.style.display = 'block';downloadBtn.style.display = 'none';const formData = new FormData();formData.append('audio', document.getElementById('audioInput').files[0]);formData.append('size', document.getElementById('sizeInput').value);// 1. Uploading Progressconst xhr = new XMLHttpRequest();xhr.open('POST', '/process', true);xhr.upload.onprogress = (e) => {if (e.lengthComputable) {const percent = Math.round((e.loaded / e.total) * 100);statusText.innerText = "Uploading Audio: " + percent + "%";progressBar.style.width = percent + "%";percentText.innerText = percent + "%";}};xhr.onload = function() {if (xhr.status === 200) {statusText.innerText = "Audio Received! Analyzing Beats...";startPolling();} else {alert("Error starting process");resetUI();}};xhr.send(formData);};function startPolling() {let poll = setInterval(async () => {try {const res = await fetch('/progress');const data = await res.json();if (data.progress > 0 && data.progress < 100) {statusText.innerText = "AI Rendering Video: " + data.progress + "%";progressBar.style.width = data.progress + "%";percentText.innerText = data.progress + "%";}else if (data.progress === 100) {clearInterval(poll);statusText.innerText = "✅ VIDEO COMPLETED!";progressBar.style.width = "100%";percentText.innerText = "100%";downloadBtn.style.display = 'flex';downloadBtn.href = "/download";startBtn.disabled = false; // Allow next use}else if (data.progress === -1) {clearInterval(poll);alert("Render failed. Try a shorter audio.");resetUI();}} catch (e) { console.log("Polling..."); }}, 2000);}function resetUI() {startBtn.disabled = false;document.getElementById('audioInput').disabled = false;document.getElementById('sizeInput').disabled = false;progressBox.style.display = 'none';}</script></body>2 unmodified lines34567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242 unmodified lines<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>VibeSync Pro | 7-Color Rainbow Visualizer</title><style>body {background: #050505;color: #fff;font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;display: flex;justify-content: center;align-items: center;min-height: 100vh;margin: 0;}.card {background: #000;border: 2px solid #ff0050;padding: 30px;border-radius: 25px;width: 90%;max-width: 450px;text-align: center;box-shadow: 0 0 30px rgba(255, 0, 80, 0.4);}h2 {letter-spacing: 6px;margin-bottom: 5px;font-size: 28px;}h2 span { color: #00f2ea; }p.subtitle {font-size: 10px;color: #555;text-transform: uppercase;letter-spacing: 2px;margin-bottom: 30px;}.input-group {text-align: left;margin-bottom: 15px;}label {display: block;font-size: 11px;color: #00f2ea;margin-bottom: 5px;text-transform: uppercase;font-weight: bold;}input {width: 100%;padding: 12px;background: #111;border: 1px solid #333;color: #fff;border-radius: 10px;box-sizing: border-box;}.btn {width: 100%;padding: 15px;margin-top: 20px;border-radius: 12px;border: none;background: linear-gradient(45deg, #ff0050, #00f2ea);color: #fff;font-weight: bold;font-size: 16px;cursor: pointer;transition: 0.3s;}.btn:hover { transform: scale(1.02); opacity: 0.9; }.btn:disabled { background: #333; cursor: not-allowed; }#prog {display: none;margin-top: 25px;padding: 15px;background: #0a0a0a;border-radius: 15px;}.bar-container {background: #222;height: 10px;border-radius: 5px;margin: 10px 0;overflow: hidden;}.fill {background: linear-gradient(90deg, #00f2ea, #ff0050);width: 0%;height: 100%;transition: 0.4s;box-shadow: 0 0 10px #00f2ea;}#st { font-size: 13px; color: #00f2ea; font-weight: bold; }#dl-box {display: none;margin-top: 20px;padding: 15px;border: 1px dashed #00f2ea;border-radius: 10px;}.dl-link {color: #00f2ea;text-decoration: none;font-weight: bold;font-size: 18px;}</style></head><body><div class="card"><h2>VIBE<span>SYNC</span></h2><p class="subtitle">Premium Rainbow Visualizer AI</p><form id="vibeForm"><div class="input-group"><label>Select Audio (Full Song)</label><input type="file" id="audio" accept="audio/*" required></div><div class="input-group"><label>Left Side Icon</label><input type="file" id="img1" accept="image/*" required></div><div class="input-group"><label>Right Side Icon</label><input type="file" id="img2" accept="image/*" required></div><button type="submit" class="btn" id="sBtn">GENERATE PRO VIDEO 🌈</button></form><div id="prog"><p id="st">Starting AI Process...</p><div class="bar-container"><div class="fill" id="bf"></div></div><p id="pct" style="font-size: 12px; color: #ff0050;">0%</p></div><div id="dl-box"><p style="margin:0 0 10px 0; font-size: 12px;">Processing Complete!</p><a id="dl" class="dl-link" href="/download">DOWNLOAD MP4 📥</a></div></div><script>const form = document.getElementById('vibeForm');const sBtn = document.getElementById('sBtn');const prog = document.getElementById('prog');const fill = document.getElementById('bf');const st = document.getElementById('st');const pct = document.getElementById('pct');const dlBox = document.getElementById('dl-box');form.onsubmit = async (e) => {e.preventDefault();// UI UpdatesBtn.disabled = true;prog.style.display = 'block';dlBox.style.display = 'none';st.innerText = "Uploading Files to Server...";const fd = new FormData();fd.append('audio', document.getElementById('audio').files[0]);fd.append('img1', document.getElementById('img1').files[0]);fd.append('img2', document.getElementById('img2').files[0]);try {const res = await fetch('/process', { method: 'POST', body: fd });if (res.ok) {st.innerText = "Files Received. AI Rendering Started...";startPolling();} else {alert("Server Busy or Error!");resetUI();}} catch (err) {alert("Connection Error!");resetUI();}};function startPolling() {let itv = setInterval(async () => {try {const r = await fetch('/progress');const d = await r.json();if(d.progress > 0 && d.progress < 100) {fill.style.width = d.progress + '%';pct.innerText = d.progress + '%';st.innerText = "AI Rendering Video Frames...";}if(d.progress === 100) {clearInterval(itv);fill.style.width = '100%';pct.innerText = '100%';st.innerText = "✅ VIDEO GENERATED SUCCESSFULLY!";dlBox.style.display = 'block';sBtn.disabled = false;}if(d.progress === -1) {clearInterval(itv);alert("Error during rendering. Check file formats.");resetUI();}} catch (e) { console.log("Polling..."); }}, 2500);}function resetUI() {sBtn.disabled = false;prog.style.display = 'none';}</script></body>
templates/index.html+177-93