Update templates/index.html
Browse files2 unmodified lines34566789101112131415168910111819202122232425261213141516171819202122282930313233343536373839404142232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970454647484950515253545556575871727374757677787980818283848586878861626364656667686970717289909192939495969798991001011021031041051061071087475767778798081828384858610911011111211311411511611711811912012112212312412512612792939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281281291301311321331341351361371381391401411421431441451461471481491501511521531541551311321331561571581591601611621631641651661671681691701711371381391401411421431441451461471481491501511521531721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232241552252262272282292301571581591601611621631641651661672312322332342352362372382392402412422432442451701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002462472482492502512522532542552022032042052062562572 unmodified lines<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>VibeSync AI | Pro Visualizer</title> <title>VibeSync AI | Avee Visualizer Pro</title> <style> body { background: #050505; color: white; font-family: 'Segoe UI', Arial, sans-serif; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; :root { --neon-blue: #00f2ea; --neon-pink: #ff0050; } .card { background: #000; border: 2px solid #00f2ea; padding: 35px; border-radius: 25px; width: 90%; max-width: 420px; text-align: center; box-shadow: 0 0 30px rgba(0, 242, 234, 0.2); body { background: #080808; color: #ffffff; font-family: 'Segoe UI', Roboto, sans-serif; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; overflow-x: hidden; } h2 { letter-spacing: 5px; margin-bottom: 5px; font-size: 26px; } h2 span { color: #ff0050; } .subtitle { font-size: 10px; color: #555; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 25px; display: block; } .input-group { text-align: left; margin-bottom: 15px; } label { display: block; font-size: 11px; color: #00f2ea; margin-bottom: 6px; text-transform: uppercase; font-weight: bold; } input, select { width: 100%; padding: 12px; background: #111; border: 1px solid #333; color: #fff; border-radius: 12px; box-sizing: border-box; .container { background: rgba(0, 0, 0, 0.9); border: 2px solid var(--neon-blue); padding: 40px; border-radius: 30px; width: 100%; max-width: 450px; text-align: center; box-shadow: 0 0 40px rgba(0, 242, 234, 0.2); position: relative; } h1 { letter-spacing: 6px; margin-bottom: 5px; font-size: 28px; text-transform: uppercase; } h1 span { color: var(--neon-pink); } .tagline { font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: 3px; margin-bottom: 30px; } .input-group { text-align: left; margin-bottom: 18px; } label { display: block; font-size: 11px; color: var(--neon-pink); margin-bottom: 8px; text-transform: uppercase; font-weight: 700; } input, select { width: 100%; padding: 14px; background: #151515; border: 1px solid #333; color: #fff; border-radius: 15px; box-sizing: border-box; outline: none; transition: 0.3s; } input:focus { border-color: #ff0050; }
.btn { width: 100%; padding: 16px; margin-top: 15px; border-radius: 12px; border: none; background: linear-gradient(45deg, #00f2ea, #ff0050); color: #fff; font-weight: bold; font-size: 16px; cursor: pointer; transition: 0.3s; input:focus { border-color: var(--neon-blue); } input:disabled, select:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-generate { width: 100%; padding: 18px; margin-top: 20px; border-radius: 15px; border: none; background: linear-gradient(45deg, var(--neon-blue), var(--neon-pink)); color: #fff; font-weight: bold; font-size: 16px; cursor: pointer; text-transform: uppercase; box-shadow: 0 5px 15px rgba(255, 0, 80, 0.3); transition: 0.3s; } .btn:hover { opacity: 0.9; transform: scale(1.02); } .btn:disabled { background: #333; cursor: not-allowed; transform: none; }
/* Progress System Styling */ #prog-box { display: none; margin-top: 25px; border-top: 1px solid #222; padding-top: 20px; } .bar-container { background: #222; height: 12px; border-radius: 6px; margin: 12px 0; overflow: hidden; } .fill { background: linear-gradient(90deg, #ff0050, #00f2ea); width: 0%; height: 100%; transition: 0.4s ease; box-shadow: 0 0 10px #00f2ea; .btn-generate:hover { transform: scale(1.02); box-shadow: 0 8px 20px rgba(0, 242, 234, 0.4); } .btn-generate:disabled { background: #333; box-shadow: none; }
/* Progress Area */ #progressArea { display: none; margin-top: 30px; } .progress-label { font-size: 14px; color: var(--neon-blue); margin-bottom: 10px; font-weight: bold; } .progress-bar { background: #222; height: 12px; border-radius: 6px; overflow: hidden; margin-bottom: 5px; } .progress-fill { background: linear-gradient(90deg, var(--neon-blue), var(--neon-pink)); width: 0%; height: 100%; transition: 0.4s; box-shadow: 0 0 15px var(--neon-blue); } #st { font-size: 13px; color: #00f2ea; font-weight: bold; } #pct { font-size: 22px; color: #ff0050; font-weight: bold; margin: 5px 0; }
#dl-box { display: none; margin-top: 25px; } .dl-btn { background: #238636; color: white; padding: 15px; display: block; text-decoration: none; border-radius: 12px; font-weight: bold; box-shadow: 0 4px 15px rgba(35, 134, 54, 0.3); .percentage { font-size: 12px; color: var(--neon-pink); }
/* Download Section */ #downloadArea { display: none; margin-top: 30px; padding-top: 20px; border-top: 1px solid #222; } .download-btn { background: #2ecc71; color: white; padding: 16px; display: block; text-decoration: none; border-radius: 15px; font-weight: bold; transition: 0.3s; } .download-btn:hover { background: #27ae60; box-shadow: 0 5px 15px rgba(46, 204, 113, 0.4); } </style></head><body>
<div class="card"> <h2>VIBE<span>SYNC</span></h2> <span class="subtitle">Neon Audio Visualizer AI</span> <form id="vibeForm"> <div class="input-group"> <label>1. Audio (Song)</label> <input type="file" name="audio" accept="audio/*" required> </div> <div class="input-group"> <label>2. Left Icon (Logo)</label> <input type="file" name="img1" accept="image/*" required> </div> <div class="input-group"> <label>3. Right Icon (Logo)</label> <input type="file" name="img2" accept="image/*" required> </div> <div class="input-group"> <label>4. Background Photo (Optional)</label> <input type="file" name="bg" accept="image/*"> </div> <div class="input-group"> <label>5. Video Size</label> <select name="size"> <option value="9:16">Portrait (Shorts/Reels)</option> <option value="16:9">Landscape (YouTube)</option> </select> </div> <button type="submit" class="btn" id="sBtn">Start Rendering 🚀</button> </form>
<div id="prog-box"> <p id="st">Uploading Files...</p> <div id="pct">0%</div> <div class="bar-container"> <div class="fill" id="fill"></div> </div><div class="container"> <h1>VIBE<span>SYNC</span> PRO</h1> <p class="tagline">Avee Style Audio Visualizer</p> <form id="uploadForm"> <div class="input-group"> <label>1. Select Format</label> <select id="size" required> <option value="9:16">Reels/Shorts (9:16)</option> <option value="16:9">YouTube Landscape (16:9)</option> </select> </div>
<div class="input-group"> <label>2. Upload Song (MP3)</label> <input type="file" id="audio" accept="audio/*" required> </div>
<div class="input-group"> <label>3. Background Photo (Manual Selection)</label> <input type="file" id="bg" accept="image/*" required> </div>
<div class="input-group"> <label>4. Left Side Icon</label> <input type="file" id="img1" accept="image/*" required> </div>
<div id="dl-box"> <a id="dl-link" class="dl-btn" href="/download">Download Video 📥</a> <p style="font-size: 11px; color: #555; margin-top: 10px;">Render Complete! Click to save.</p> <div class="input-group"> <label>5. Right Side Icon</label> <input type="file" id="img2" accept="image/*" required> </div>
<button type="submit" class="btn-generate" id="submitBtn">Create Visualizer 🌈</button> </form>
<div id="progressArea"> <p class="progress-label" id="statusText">Processing Audio...</p> <div class="progress-bar"> <div class="progress-fill" id="progressFill"></div> </div> <p class="percentage" id="percentText">0%</p> </div>
<script> const form = document.getElementById('vibeForm'); const sBtn = document.getElementById('sBtn'); const progBox = document.getElementById('prog-box'); const fill = document.getElementById('fill'); const pctText = document.getElementById('pct'); const stText = document.getElementById('st'); const dlBox = document.getElementById('dl-box');
form.onsubmit = async (e) => { e.preventDefault(); // UI Reset sBtn.disabled = true; progBox.style.display = 'block'; dlBox.style.display = 'none'; stText.innerText = "Sending to Server..."; <div id="downloadArea"> <a id="downloadLink" class="download-btn" href="/download">Download Master Video 📥</a> <p style="font-size: 10px; color: #555; margin-top: 10px;">Video rendering complete. You can download now.</p> </div></div>
<script> const form = document.getElementById('uploadForm'); const submitBtn = document.getElementById('submitBtn'); const progressArea = document.getElementById('progressArea'); const progressFill = document.getElementById('progressFill'); const statusText = document.getElementById('statusText'); const percentText = document.getElementById('percentText'); const downloadArea = document.getElementById('downloadArea'); const inputs = form.querySelectorAll('input, select');
form.onsubmit = async (e) => { e.preventDefault(); // UI Lockdown submitBtn.disabled = true; inputs.forEach(i => i.disabled = true); progressArea.style.display = 'block'; downloadArea.style.display = 'none'; statusText.innerText = "Uploading Files...";
const formData = new FormData(); formData.append('size', document.getElementById('size').value); formData.append('audio', document.getElementById('audio').files[0]); formData.append('bg', document.getElementById('bg').files[0]); formData.append('img1', document.getElementById('img1').files[0]); formData.append('img2', document.getElementById('img2').files[0]);
try { const response = await fetch('/process', { method: 'POST', body: formData }); if (response.ok) { statusText.innerText = "Syncing with Beat..."; checkProgress(); } else { alert("Server error. Try again."); resetUI(); } } catch (err) { alert("Connection lost."); resetUI(); } };
function checkProgress() { let interval = setInterval(async () => { const res = await fetch('/progress'); const data = await res.json(); const fd = new FormData(form); if (data.progress > 0 && data.progress < 100) { progressFill.style.width = data.progress + '%'; percentText.innerText = data.progress + '%'; statusText.innerText = "Avee Rendering: " + data.progress + "%"; } try { const res = await fetch('/process', { method: 'POST', body: fd }); if (res.ok) { stText.innerText = "AI Processing Started..."; checkProgress(); } else { alert("Server Busy! Try again."); resetUI(); } } catch (err) { alert("Connection Error."); if (data.progress === 100) { clearInterval(interval); progressFill.style.width = '100%'; percentText.innerText = '100%'; statusText.innerText = "✅ RENDER COMPLETE!"; downloadArea.style.display = 'block'; submitBtn.disabled = false; inputs.forEach(i => i.disabled = false); }
if (data.progress === -1) { clearInterval(interval); alert("Rendering failed. Check file format."); resetUI(); } };
function checkProgress() { const itv = setInterval(async () => { try { const r = await fetch('/progress'); const d = await r.json(); if (d.progress > 0) { fill.style.width = d.progress + '%'; pctText.innerText = d.progress + '%'; stText.innerText = "Rendering Video Frames..."; } if (d.progress === 100) { clearInterval(itv); stText.innerText = "✅ Rendering Finished!"; dlBox.style.display = 'block'; sBtn.disabled = false; }
if (d.progress === -1) { clearInterval(itv); alert("Error during rendering!"); resetUI(); } } catch (e) { console.log("Polling..."); } }, 3000); // Check every 3 seconds } }, 3000); }
function resetUI() { submitBtn.disabled = false; inputs.forEach(i => i.disabled = false); progressArea.style.display = 'none'; }</script>
function resetUI() { sBtn.disabled = false; progBox.style.display = 'none'; } </script></body></html>templates/index.html+227-178