Fa / index.html
1joker's picture
Upload index.html with huggingface_hub
c4775e3 verified
Raw History Blame Contribute Delete
3.73 kB
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Rejoke</title>
<style>
*{box-sizing:border-box}
body{margin:0;font-family:'Segoe UI',system-ui,sans-serif;background:radial-gradient(1200px 600px at 20% -10%,#2e0a12,#0c0c0f 65%);color:#eee;min-height:100vh;display:flex;flex-direction:column}
header{display:flex;align-items:center;gap:12px;padding:14px 20px;border-bottom:1px solid rgba(255,255,255,.14);background:rgba(0,0,0,.35)}
.emoji{font-size:34px}
h1{margin:0;font-size:19px;color:#ff6b9d}
.sub{font-size:12px;color:#999}
.wrap{max-width:700px;margin:0 auto;padding:16px;width:100%;flex:1;display:flex;flex-direction:column}
.stage{position:relative;border:1px solid rgba(255,255,255,.15);border-radius:16px;overflow:hidden;background:#15151b;min-height:150px;display:flex;align-items:center;justify-content:center;margin-bottom:14px}
.stage video{width:100%;max-height:340px;display:block}
.card{text-align:center;color:#bbb;padding:26px}
.card .big{font-size:72px}
.msg{max-width:78%;padding:9px 13px;border-radius:14px;margin:6px 0;white-space:pre-wrap;line-height:1.4}
.u{align-self:flex-end;background:#e91e63;color:#fff}
.j{align-self:flex-start;background:#1d1d24;border:1px solid rgba(255,255,255,.14)}
#logs{flex:1;overflow-y:auto;display:flex;flex-direction:column;margin-bottom:12px;min-height:120px}
.bar{display:flex;gap:8px}
textarea{flex:1;resize:none;padding:12px;border-radius:12px;border:1px solid rgba(255,255,255,.2);background:#14141a;color:#eee;font-size:15px;font-family:inherit;min-height:44px}
button{border:0;border-radius:12px;padding:0 18px;font-size:15px;cursor:pointer;background:#2e7d32;color:#fff;font-weight:600}
#clear{background:#600}
.hint{color:#777;font-size:12px;margin-top:8px}
</style>
</head>
<body>
<header><span class="emoji">🃏</span><div><h1>Rejoke</h1><div class="sub">Le Joker — visage animé D-ID · voix Edge-TTS</div></div></header>
<div class="wrap">
<div class="stage">
<video id="vid" controls playsinline autoplay muted style="display:none"></video>
<div class="card" id="card"><div class="big">🃏</div><div>Parle au Joker...</div></div>
</div>
<div id="logs"></div>
<div class="bar"><textarea id="in" rows="1" placeholder="Écris un message..."></textarea><button id="go">Envoyer</button><button id="cl" title="Vider">🗑️</button></div>
<div class="hint">Groq · llama-3.3-70b · Whisper-Turbo · Edge-TTS · D-ID</div>
</div>
<script>
var logs=document.getElementById('logs'),inp=document.getElementById('in'),go=document.getElementById('go'),cl=document.getElementById('cl');
var vid=document.getElementById('vid'),card=document.getElementById('card');
function add(t,w){var d=document.createElement('div');d.className='msg '+w;d.textContent=t;logs.appendChild(d);logs.scrollTop=logs.scrollHeight;}
function showVid(url){card.style.display='none';vid.style.display='block';vid.src=url;vid.muted=false;vid.play().catch(function(){});}
async function chat(){
var msg=inp.value.trim();if(!msg)return;add(msg,'u');inp.value='';
try{
var r=await fetch('/chat',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({message:msg,use_did:true})});
var j=await r.json();
if(j.error){add('Erreur : '+j.error,'j');return;}
add(j.text,'j');
if(j.video_url){showVid(j.video_url);}
else if(j.audio_url){var a=new Audio(j.audio_url);a.play().catch(function(){});}
}catch(e){add('Problème réseau : '+e,'j');}
}
go.onclick=chat;inp.onkeydown=function(e){if(e.key==='Enter'){e.preventDefault();chat();}};
cl.onclick=function(){logs.innerHTML='';fetch('/clear',{method:'POST'}).catch(function(){});};
</script>
</body>
</html>