Spaces:
Sleeping
Sleeping
Download index.html from LoopBreakers-ai/LoopBreakers: direct link, hf CLI and curl.
- Browser
- Download file 18.1 kB
-
https://huggingface.co/spaces/LoopBreakers-ai/LoopBreakers/resolve/main/index.html
- Command line
-
hf download hf://spaces/LoopBreakers-ai/LoopBreakers/index.html
-
curl -L -o index.html https://huggingface.co/spaces/LoopBreakers-ai/LoopBreakers/resolve/main/index.html
18.1 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>LoopBreakers – Reward-Hacking Resistant Math AI</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <!-- KaTeX CSS and JS --> | |
| <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css"> | |
| <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.js"></script> | |
| <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/contrib/auto-render.min.js" | |
| onload="renderMathInElement(document.body, { | |
| delimiters: [ | |
| {left: '$$', right: '$$', display: true}, | |
| {left: '\\(', right: '\\)', display: false} | |
| ] | |
| });"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script> | |
| <style> | |
| .gradient-bg { | |
| background: linear-gradient(135deg, #7e22ce 0%, #9333ea 50%, #a855f7 100%); | |
| } | |
| .solution-section { | |
| transition: all 0.3s ease; | |
| max-height: 0; | |
| overflow: hidden; | |
| } | |
| .solution-section.show { | |
| max-height: 2000px; | |
| } | |
| .fade-in { | |
| animation: fadeIn 0.5s ease-in-out; | |
| } | |
| @keyframes fadeIn { | |
| from { opacity: 0; transform: translateY(10px); } | |
| to { opacity: 1; transform: translateY(0); } | |
| } | |
| .step-highlight { | |
| border-left: 4px solid #9333ea; | |
| background-color: #f5f3ff; | |
| } | |
| textarea { | |
| min-height: 120px; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50 min-h-screen"> | |
| <!-- Header --> | |
| <header class="gradient-bg text-white shadow-lg"> | |
| <div class="container mx-auto px-4 py-6"> | |
| <div class="flex justify-between items-center"> | |
| <div class="flex items-center space-x-2"> | |
| <i class="fas fa-robot text-3xl"></i> | |
| <h1 class="text-2xl md:text-3xl font-bold">LoopBreakers</h1> | |
| </div> | |
| <p class="text-sm md:text-base font-medium bg-white/20 px-3 py-1 rounded-full"> | |
| Reward-Hacking Resistant Math AI | |
| </p> | |
| </div> | |
| </div> | |
| </header> | |
| <!-- Main Content --> | |
| <main class="container mx-auto px-4 py-8"> | |
| <div class="max-w-4xl mx-auto"> | |
| <!-- Intro Section --> | |
| <section class="mb-12 text-center"> | |
| <h2 class="text-3xl font-bold text-gray-800 mb-3">AI-Powered Math Problem Solver</h2> | |
| <p class="text-gray-600 text-lg"> | |
| Get reliable, step-by-step solutions for Year 5–10 math problems with alignment-focused explanations. | |
| </p> | |
| </section> | |
| <!-- Input Section --> | |
| <section class="mb-8 bg-white rounded-xl shadow-md overflow-hidden"> | |
| <div class="p-6"> | |
| <label for="math-problem" class="block text-lg font-medium text-gray-700 mb-3"> | |
| Enter your math word problem: | |
| </label> | |
| <textarea | |
| id="math-problem" | |
| class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 transition" | |
| placeholder="E.g., If a train leaves station A at 60 mph and another leaves station B at 40 mph 2 hours later, when will they meet if the stations are 300 miles apart?" | |
| ></textarea> | |
| </div> | |
| <div class="bg-gray-50 px-6 py-4 flex justify-end"> | |
| <button id="solve-btn" class="gradient-bg text-white px-6 py-3 rounded-lg font-medium hover:opacity-90 transition flex items-center"> | |
| <i class="fas fa-lightbulb mr-2"></i> Get Solution | |
| </button> | |
| </div> | |
| </section> | |
| <!-- Solution Section (Initially hidden) --> | |
| <section id="solution-section" class="solution-section bg-white rounded-xl shadow-md overflow-hidden mb-8"> | |
| <div class="p-6"> | |
| <!-- Loading State --> | |
| <div id="loading" class="text-center py-8 hidden"> | |
| <div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-purple-500 mx-auto mb-4"></div> | |
| <p class="text-gray-600">Analyzing your problem with alignment-focused reasoning...</p> | |
| </div> | |
| <!-- Solution Content --> | |
| <div id="solution-content" class="hidden fade-in"> | |
| <!-- Step-by-Step Explanation --> | |
| <div class="mb-8"> | |
| <h3 class="text-xl font-bold text-gray-800 mb-4 flex items-center"> | |
| <i class="fas fa-list-ol text-purple-600 mr-2"></i> Step-by-Step Explanation | |
| </h3> | |
| <div id="steps-container" class="space-y-4"> | |
| <!-- Steps will be inserted here by JavaScript --> | |
| </div> | |
| </div> | |
| <!-- Final Answer --> | |
| <div class="mb-8 p-4 bg-purple-50 rounded-lg border border-purple-100"> | |
| <h3 class="text-xl font-bold text-gray-800 mb-2 flex items-center"> | |
| <i class="fas fa-check-circle text-purple-600 mr-2"></i> Final Answer | |
| </h3> | |
| <p id="final-answer" class="text-2xl font-bold text-purple-700"> | |
| <!-- Final answer will be inserted here --> | |
| </p> | |
| </div> | |
| <!-- Alignment Reasoning --> | |
| <div class="mb-8"> | |
| <h3 class="text-xl font-bold text-gray-800 mb-4 flex items-center"> | |
| <i class="fas fa-brain text-purple-600 mr-2"></i> Alignment Reasoning | |
| </h3> | |
| <div id="alignment-reasoning" class="bg-gray-50 p-4 rounded-lg"> | |
| <!-- Alignment reasoning will be inserted here --> | |
| </div> | |
| </div> | |
| <div class="flex justify-end mt-4"> | |
| <button id="download-pdf" class="bg-purple-600 text-white px-5 py-2 rounded-lg font-medium hover:opacity-90 transition"> | |
| <i class="fas fa-download mr-2"></i>Download PDF | |
| </button> | |
| </div> | |
| <!-- Feedback Section --> | |
| <div class="border-t pt-6"> | |
| <h3 class="text-lg font-medium text-gray-700 mb-3">Was this solution helpful?</h3> | |
| <div class="flex space-x-4"> | |
| <button id="correct-btn" class="flex-1 bg-green-100 text-green-800 px-4 py-2 rounded-lg font-medium hover:bg-green-200 transition flex items-center justify-center"> | |
| <i class="fas fa-thumbs-up mr-2"></i> Correct | |
| </button> | |
| <button id="incorrect-btn" class="flex-1 bg-red-100 text-red-800 px-4 py-2 rounded-lg font-medium hover:bg-red-200 transition flex items-center justify-center"> | |
| <i class="fas fa-thumbs-down mr-2"></i> Incorrect | |
| </button> | |
| </div> | |
| <div id="feedback-thanks" class="hidden mt-3 text-center text-green-600 font-medium"> | |
| <i class="fas fa-check-circle mr-1"></i> Thank you for your feedback! | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Features Section --> | |
| <section class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12"> | |
| <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100"> | |
| <div class="text-purple-600 mb-3"> | |
| <i class="fas fa-shield-alt text-2xl"></i> | |
| </div> | |
| <h3 class="font-bold text-lg mb-2">Alignment Focused</h3> | |
| <p class="text-gray-600">Our AI explains why each step aligns with proper mathematical reasoning, not just pattern matching.</p> | |
| </div> | |
| <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100"> | |
| <div class="text-purple-600 mb-3"> | |
| <i class="fas fa-graduation-cap text-2xl"></i> | |
| </div> | |
| <h3 class="font-bold text-lg mb-2">Curriculum Aligned</h3> | |
| <p class="text-gray-600">Solutions tailored for Year 5–10 students, matching school curriculum standards.</p> | |
| </div> | |
| <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100"> | |
| <div class="text-purple-600 mb-3"> | |
| <i class="fas fa-mobile-alt text-2xl"></i> | |
| </div> | |
| <h3 class="font-bold text-lg mb-2">Mobile Friendly</h3> | |
| <p class="text-gray-600">Learn on any device with our responsive design that works perfectly on phones and tablets.</p> | |
| </div> | |
| </section> | |
| </div> | |
| </main> | |
| <!-- Footer --> | |
| <footer class="bg-gray-800 text-white py-8"> | |
| <div class="container mx-auto px-4"> | |
| <div class="max-w-4xl mx-auto flex flex-col md:flex-row justify-between items-center"> | |
| <div class="mb-4 md:mb-0"> | |
| <h2 class="text-xl font-bold flex items-center"> | |
| <i class="fas fa-robot mr-2"></i> LoopBreakers | |
| </h2> | |
| <p class="text-gray-400 text-sm mt-1">Reward-Hacking Resistant Math AI</p> | |
| </div> | |
| <div class="flex space-x-6"> | |
| <a href="#" class="text-gray-300 hover:text-white transition"> | |
| <i class="fab fa-twitter"></i> | |
| </a> | |
| <a href="#" class="text-gray-300 hover:text-white transition"> | |
| <i class="fab fa-facebook"></i> | |
| </a> | |
| <a href="#" class="text-gray-300 hover:text-white transition"> | |
| <i class="fab fa-instagram"></i> | |
| </a> | |
| </div> | |
| </div> | |
| <div class="max-w-4xl mx-auto mt-6 pt-6 border-t border-gray-700 text-center text-gray-400 text-sm"> | |
| <p>© 2023 LoopBreakers. All rights reserved.</p> | |
| </div> | |
| </div> | |
| </footer> | |
| <script> | |
| document.getElementById('download-pdf').addEventListener('click', function () { | |
| const { jsPDF } = window.jspdf; | |
| const doc = new jsPDF(); | |
| const problem = document.getElementById('math-problem').value; | |
| const steps = Array.from(document.querySelectorAll('#steps-container .step-highlight')) | |
| .map(el => el.textContent.trim()); | |
| const answer = document.getElementById('final-answer').textContent; | |
| let y = 10; | |
| doc.setFontSize(14); | |
| doc.text("Math Problem:", 10, y); | |
| y += 10; | |
| doc.setFontSize(12); | |
| doc.text(problem, 10, y); | |
| y += 15; | |
| doc.setFontSize(14); | |
| doc.text("Step-by-Step Working:", 10, y); | |
| y += 10; | |
| steps.forEach((step, i) => { | |
| const lines = doc.splitTextToSize(`${i + 1}. ${step}`, 180); | |
| doc.text(lines, 10, y); | |
| y += lines.length * 7; | |
| if (y > 270) { | |
| doc.addPage(); | |
| y = 10; | |
| } | |
| }); | |
| doc.setFontSize(14); | |
| doc.text("Final Answer:", 10, y + 10); | |
| doc.setFontSize(12); | |
| doc.text(answer, 10, y + 20); | |
| doc.save("math_solution.pdf"); | |
| }); | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const solveBtn = document.getElementById('solve-btn'); | |
| const solutionSection = document.getElementById('solution-section'); | |
| const loading = document.getElementById('loading'); | |
| const solutionContent = document.getElementById('solution-content'); | |
| const mathProblemInput = document.getElementById('math-problem'); | |
| const stepsContainer = document.getElementById('steps-container'); | |
| const finalAnswer = document.getElementById('final-answer'); | |
| const alignmentReasoning = document.getElementById('alignment-reasoning'); | |
| const correctBtn = document.getElementById('correct-btn'); | |
| const incorrectBtn = document.getElementById('incorrect-btn'); | |
| const feedbackThanks = document.getElementById('feedback-thanks'); | |
| solveBtn.addEventListener('click', function() { | |
| const problem = mathProblemInput.value.trim(); | |
| if (!problem) { | |
| alert('Please enter a math problem to solve.'); | |
| return; | |
| } | |
| // Show loading | |
| solutionSection.classList.add('show'); | |
| loading.classList.remove('hidden'); | |
| solutionContent.classList.add('hidden'); | |
| stepsContainer.innerHTML = ''; | |
| finalAnswer.textContent = ''; | |
| alignmentReasoning.textContent = ''; | |
| // Send to backend | |
| fetch("/solve", { | |
| method: "POST", | |
| headers: { | |
| "Content-Type": "application/json" | |
| }, | |
| body: JSON.stringify({ question: problem }) | |
| }) | |
| .then(res => res.json()) | |
| .then(data => { | |
| loading.classList.add('hidden'); | |
| solutionContent.classList.remove('hidden'); | |
| const steps = data.steps.split('\n').filter(line => line.trim() !== ""); | |
| steps.forEach((step, index) => { | |
| const stepElement = document.createElement('div'); | |
| stepElement.className = 'step-highlight p-4 rounded-lg flex'; | |
| const numberBadge = document.createElement('span'); | |
| numberBadge.className = 'flex-shrink-0 bg-purple-600 text-white rounded-full w-6 h-6 flex items-center justify-center mr-3'; | |
| numberBadge.textContent = index + 1; | |
| const content = document.createElement('div'); | |
| content.innerHTML = step; | |
| // 🧠 Automatically render LaTeX inside the step | |
| if (window.renderMathInElement) { | |
| renderMathInElement(content, { | |
| delimiters: [ | |
| {left: '$$', right: '$$', display: true}, | |
| {left: '$', right: '$', display: false} | |
| ] | |
| }); | |
| } | |
| stepElement.appendChild(numberBadge); | |
| stepElement.appendChild(content); | |
| stepsContainer.appendChild(stepElement); | |
| }); | |
| finalAnswer.innerHTML = data.final_answer; | |
| if (window.renderMathInElement) { | |
| renderMathInElement(finalAnswer, { | |
| delimiters: [ | |
| {left: '$$', right: '$$', display: true}, | |
| {left: '$', right: '$', display: false} | |
| ] | |
| }); | |
| } | |
| alignmentReasoning.textContent = "Reasoning is generated with reward-hacking resistance in mind. The model uses prompting strategies to ensure it avoids shortcuts or incorrect logic patterns."; | |
| }) | |
| .catch(err => { | |
| loading.classList.add('hidden'); | |
| alert("❌ Error fetching solution. Please try again."); | |
| console.error(err); | |
| }); | |
| }); | |
| correctBtn.addEventListener('click', function() { | |
| feedbackThanks.classList.remove('hidden'); | |
| setTimeout(() => feedbackThanks.classList.add('hidden'), 3000); | |
| }); | |
| incorrectBtn.addEventListener('click', function() { | |
| feedbackThanks.textContent = "We'll review this solution to improve our AI. Thank you!"; | |
| feedbackThanks.className = "hidden mt-3 text-center text-purple-600 font-medium"; | |
| feedbackThanks.classList.remove('hidden'); | |
| setTimeout(() => feedbackThanks.classList.add('hidden'), 3000); | |
| }); | |
| mathProblemInput.addEventListener('input', function() { | |
| this.style.height = 'auto'; | |
| this.style.height = (this.scrollHeight) + 'px'; | |
| }); | |
| }); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=JoshAbrahams21/loopbreakers" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> | |