Oliverceff/cleary-interface
0
1<!DOCTYPE html>2<html lang="fr">3<head>4 <meta charset="UTF-8">5 <title>Assistant Cleary</title>6 <style>7 body {8 font-family: Arial, sans-serif;9 padding: 30px;10 background: #f5f5f5;11 max-width: 700px;12 margin: auto;13 }14 h1 {15 color: #222;16 }17 textarea {18 width: 100%;19 height: 140px;20 font-size: 16px;21 padding: 10px;22 margin-top: 10px;23 margin-bottom: 20px;24 border: 1px solid #ccc;25 border-radius: 6px;26 resize: vertical;27 }28 button {29 background-color: #0073e6;30 color: white;31 padding: 10px 20px;32 font-size: 16px;33 border: none;34 border-radius: 6px;35 cursor: pointer;36 }37 #resultat {38 margin-top: 20px;39 background: #ffffff;40 padding: 15px;41 border-left: 5px solid #0073e6;42 border-radius: 4px;43 font-size: 18px;44 min-height: 20px;45 }46 </style>47</head>48<body>49 <h1>🧠 Assistant Cleary</h1>50 <p>Collez un commentaire d'élève ou un feedback à analyser :</p>51 52 <textarea id="texte" placeholder="Ex : Vous devez faire plus attention aux consignes..."></textarea>53 <button onclick="analyser()">Analyser</button>54 55 <div id="resultat"></div>56 57 <script>58 async function analyser() {59 const texte = document.getElementById('texte').value.trim();60 const resultat = document.getElementById('resultat');61 resultat.innerHTML = 'Analyse en cours...';62 63 try {64 const response = await fetch("https://huggingface.co/spaces/Oliverceff/FeedbackTFI/predict", {65 method: "POST",66 headers: { "Content-Type": "application/json" },67 body: JSON.stringify({ texte: texte })68 });69 70 const data = await response.json();71 72 if (data.niveau) {73 resultat.innerHTML = `<strong>Niveau prédit :</strong> ${data.niveau}`;74 } else if (data.error) {75 resultat.innerHTML = `<span style="color:red;">Erreur : ${data.error}</span>`;76 } else {77 resultat.innerHTML = 'Erreur inconnue';78 }79 } catch (e) {80 resultat.innerHTML = `<span style="color:red;">Erreur : ${e.message}</span>`;81 }82 }83 </script>84</body>85</html>86 