JoshAbrahams21 commited on
Commit
83bf9a2
·
verified ·
1 Parent(s): 39b7117

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +331 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Loopbreakers
3
- emoji: 🚀
4
- colorFrom: pink
5
- colorTo: gray
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: loopbreakers
3
+ emoji: 🐳
4
+ colorFrom: purple
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,331 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>LoopBreakers – Reward-Hacking Resistant Math AI</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .gradient-bg {
11
+ background: linear-gradient(135deg, #7e22ce 0%, #9333ea 50%, #a855f7 100%);
12
+ }
13
+ .solution-section {
14
+ transition: all 0.3s ease;
15
+ max-height: 0;
16
+ overflow: hidden;
17
+ }
18
+ .solution-section.show {
19
+ max-height: 2000px;
20
+ }
21
+ .fade-in {
22
+ animation: fadeIn 0.5s ease-in-out;
23
+ }
24
+ @keyframes fadeIn {
25
+ from { opacity: 0; transform: translateY(10px); }
26
+ to { opacity: 1; transform: translateY(0); }
27
+ }
28
+ .step-highlight {
29
+ border-left: 4px solid #9333ea;
30
+ background-color: #f5f3ff;
31
+ }
32
+ textarea {
33
+ min-height: 120px;
34
+ }
35
+ </style>
36
+ </head>
37
+ <body class="bg-gray-50 min-h-screen">
38
+ <!-- Header -->
39
+ <header class="gradient-bg text-white shadow-lg">
40
+ <div class="container mx-auto px-4 py-6">
41
+ <div class="flex justify-between items-center">
42
+ <div class="flex items-center space-x-2">
43
+ <i class="fas fa-robot text-3xl"></i>
44
+ <h1 class="text-2xl md:text-3xl font-bold">LoopBreakers</h1>
45
+ </div>
46
+ <p class="text-sm md:text-base font-medium bg-white/20 px-3 py-1 rounded-full">
47
+ Reward-Hacking Resistant Math AI
48
+ </p>
49
+ </div>
50
+ </div>
51
+ </header>
52
+
53
+ <!-- Main Content -->
54
+ <main class="container mx-auto px-4 py-8">
55
+ <div class="max-w-4xl mx-auto">
56
+ <!-- Intro Section -->
57
+ <section class="mb-12 text-center">
58
+ <h2 class="text-3xl font-bold text-gray-800 mb-3">AI-Powered Math Problem Solver</h2>
59
+ <p class="text-gray-600 text-lg">
60
+ Get reliable, step-by-step solutions for Year 5–10 math problems with alignment-focused explanations.
61
+ </p>
62
+ </section>
63
+
64
+ <!-- Input Section -->
65
+ <section class="mb-8 bg-white rounded-xl shadow-md overflow-hidden">
66
+ <div class="p-6">
67
+ <label for="math-problem" class="block text-lg font-medium text-gray-700 mb-3">
68
+ Enter your math word problem:
69
+ </label>
70
+ <textarea
71
+ id="math-problem"
72
+ 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"
73
+ 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?"
74
+ ></textarea>
75
+ </div>
76
+ <div class="bg-gray-50 px-6 py-4 flex justify-end">
77
+ <button id="solve-btn" class="gradient-bg text-white px-6 py-3 rounded-lg font-medium hover:opacity-90 transition flex items-center">
78
+ <i class="fas fa-lightbulb mr-2"></i> Get Solution
79
+ </button>
80
+ </div>
81
+ </section>
82
+
83
+ <!-- Solution Section (Initially hidden) -->
84
+ <section id="solution-section" class="solution-section bg-white rounded-xl shadow-md overflow-hidden mb-8">
85
+ <div class="p-6">
86
+ <!-- Loading State -->
87
+ <div id="loading" class="text-center py-8 hidden">
88
+ <div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-purple-500 mx-auto mb-4"></div>
89
+ <p class="text-gray-600">Analyzing your problem with alignment-focused reasoning...</p>
90
+ </div>
91
+
92
+ <!-- Solution Content -->
93
+ <div id="solution-content" class="hidden fade-in">
94
+ <!-- Step-by-Step Explanation -->
95
+ <div class="mb-8">
96
+ <h3 class="text-xl font-bold text-gray-800 mb-4 flex items-center">
97
+ <i class="fas fa-list-ol text-purple-600 mr-2"></i> Step-by-Step Explanation
98
+ </h3>
99
+ <div id="steps-container" class="space-y-4">
100
+ <!-- Steps will be inserted here by JavaScript -->
101
+ </div>
102
+ </div>
103
+
104
+ <!-- Final Answer -->
105
+ <div class="mb-8 p-4 bg-purple-50 rounded-lg border border-purple-100">
106
+ <h3 class="text-xl font-bold text-gray-800 mb-2 flex items-center">
107
+ <i class="fas fa-check-circle text-purple-600 mr-2"></i> Final Answer
108
+ </h3>
109
+ <p id="final-answer" class="text-2xl font-bold text-purple-700">
110
+ <!-- Final answer will be inserted here -->
111
+ </p>
112
+ </div>
113
+
114
+ <!-- Alignment Reasoning -->
115
+ <div class="mb-8">
116
+ <h3 class="text-xl font-bold text-gray-800 mb-4 flex items-center">
117
+ <i class="fas fa-brain text-purple-600 mr-2"></i> Alignment Reasoning
118
+ </h3>
119
+ <div id="alignment-reasoning" class="bg-gray-50 p-4 rounded-lg">
120
+ <!-- Alignment reasoning will be inserted here -->
121
+ </div>
122
+ </div>
123
+
124
+ <!-- Feedback Section -->
125
+ <div class="border-t pt-6">
126
+ <h3 class="text-lg font-medium text-gray-700 mb-3">Was this solution helpful?</h3>
127
+ <div class="flex space-x-4">
128
+ <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">
129
+ <i class="fas fa-thumbs-up mr-2"></i> Correct
130
+ </button>
131
+ <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">
132
+ <i class="fas fa-thumbs-down mr-2"></i> Incorrect
133
+ </button>
134
+ </div>
135
+ <div id="feedback-thanks" class="hidden mt-3 text-center text-green-600 font-medium">
136
+ <i class="fas fa-check-circle mr-1"></i> Thank you for your feedback!
137
+ </div>
138
+ </div>
139
+ </div>
140
+ </div>
141
+ </section>
142
+
143
+ <!-- Features Section -->
144
+ <section class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
145
+ <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
146
+ <div class="text-purple-600 mb-3">
147
+ <i class="fas fa-shield-alt text-2xl"></i>
148
+ </div>
149
+ <h3 class="font-bold text-lg mb-2">Alignment Focused</h3>
150
+ <p class="text-gray-600">Our AI explains why each step aligns with proper mathematical reasoning, not just pattern matching.</p>
151
+ </div>
152
+ <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
153
+ <div class="text-purple-600 mb-3">
154
+ <i class="fas fa-graduation-cap text-2xl"></i>
155
+ </div>
156
+ <h3 class="font-bold text-lg mb-2">Curriculum Aligned</h3>
157
+ <p class="text-gray-600">Solutions tailored for Year 5–10 students, matching school curriculum standards.</p>
158
+ </div>
159
+ <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
160
+ <div class="text-purple-600 mb-3">
161
+ <i class="fas fa-mobile-alt text-2xl"></i>
162
+ </div>
163
+ <h3 class="font-bold text-lg mb-2">Mobile Friendly</h3>
164
+ <p class="text-gray-600">Learn on any device with our responsive design that works perfectly on phones and tablets.</p>
165
+ </div>
166
+ </section>
167
+ </div>
168
+ </main>
169
+
170
+ <!-- Footer -->
171
+ <footer class="bg-gray-800 text-white py-8">
172
+ <div class="container mx-auto px-4">
173
+ <div class="max-w-4xl mx-auto flex flex-col md:flex-row justify-between items-center">
174
+ <div class="mb-4 md:mb-0">
175
+ <h2 class="text-xl font-bold flex items-center">
176
+ <i class="fas fa-robot mr-2"></i> LoopBreakers
177
+ </h2>
178
+ <p class="text-gray-400 text-sm mt-1">Reward-Hacking Resistant Math AI</p>
179
+ </div>
180
+ <div class="flex space-x-6">
181
+ <a href="#" class="text-gray-300 hover:text-white transition">
182
+ <i class="fab fa-twitter"></i>
183
+ </a>
184
+ <a href="#" class="text-gray-300 hover:text-white transition">
185
+ <i class="fab fa-facebook"></i>
186
+ </a>
187
+ <a href="#" class="text-gray-300 hover:text-white transition">
188
+ <i class="fab fa-instagram"></i>
189
+ </a>
190
+ </div>
191
+ </div>
192
+ <div class="max-w-4xl mx-auto mt-6 pt-6 border-t border-gray-700 text-center text-gray-400 text-sm">
193
+ <p>© 2023 LoopBreakers. All rights reserved.</p>
194
+ </div>
195
+ </div>
196
+ </footer>
197
+
198
+ <script>
199
+ document.addEventListener('DOMContentLoaded', function() {
200
+ const solveBtn = document.getElementById('solve-btn');
201
+ const solutionSection = document.getElementById('solution-section');
202
+ const loading = document.getElementById('loading');
203
+ const solutionContent = document.getElementById('solution-content');
204
+ const mathProblemInput = document.getElementById('math-problem');
205
+ const stepsContainer = document.getElementById('steps-container');
206
+ const finalAnswer = document.getElementById('final-answer');
207
+ const alignmentReasoning = document.getElementById('alignment-reasoning');
208
+ const correctBtn = document.getElementById('correct-btn');
209
+ const incorrectBtn = document.getElementById('incorrect-btn');
210
+ const feedbackThanks = document.getElementById('feedback-thanks');
211
+
212
+ // Sample solutions for demonstration
213
+ const sampleSolutions = {
214
+ "basic": {
215
+ problem: "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?",
216
+ steps: [
217
+ "Understand the problem: We have two trains moving toward each other from stations 300 miles apart.",
218
+ "Calculate distance covered by first train in 2 hours: Distance = Speed × Time = 60 mph × 2 h = 120 miles.",
219
+ "Remaining distance between trains after 2 hours: 300 miles - 120 miles = 180 miles.",
220
+ "Combined speed when both are moving: 60 mph + 40 mph = 100 mph.",
221
+ "Time to cover remaining distance: Time = Distance / Speed = 180 miles / 100 mph = 1.8 hours.",
222
+ "Convert 0.8 hours to minutes: 0.8 × 60 = 48 minutes.",
223
+ "Total time from first train's departure: 2 hours + 1.8 hours = 3.8 hours (3 hours and 48 minutes)."
224
+ ],
225
+ answer: "The trains will meet after 3 hours and 48 minutes from the time the first train leaves station A.",
226
+ reasoning: "This solution follows standard relative motion principles. Each step logically follows from the previous one, ensuring the reasoning isn't just pattern matching but actually solving the problem. The time calculation is broken down into clear steps, and unit conversions are handled properly."
227
+ },
228
+ "fraction": {
229
+ problem: "A recipe calls for 3/4 cup of flour. If you want to make half the recipe, how much flour should you use?",
230
+ steps: [
231
+ "Understand the problem: We need to find half of 3/4 cup of flour.",
232
+ "To find half of a fraction, multiply it by 1/2: (3/4) × (1/2) = (3 × 1)/(4 × 2).",
233
+ "Multiply numerators: 3 × 1 = 3.",
234
+ "Multiply denominators: 4 × 2 = 8.",
235
+ "Combine results: 3/8 cup of flour.",
236
+ "Verify: 3/8 is indeed half of 3/4 (since 3/8 × 2 = 6/8 = 3/4)."
237
+ ],
238
+ answer: "You should use 3/8 cup of flour for half the recipe.",
239
+ reasoning: "This solution demonstrates proper fraction multiplication. Each operation is justified mathematically, not just procedurally. The verification step ensures the answer makes sense in context, showing alignment with mathematical reasoning rather than just producing an output."
240
+ },
241
+ "percentage": {
242
+ problem: "A shirt costs $40 after a 20% discount. What was its original price?",
243
+ steps: [
244
+ "Understand that a 20% discount means the customer pays 80% of the original price (100% - 20% = 80%).",
245
+ "Let the original price be x. Then 80% of x is $40: 0.8x = 40.",
246
+ "To find x, divide both sides by 0.8: x = 40 / 0.8.",
247
+ "Calculate: 40 ÷ 0.8 = 50.",
248
+ "Verify: 20% of $50 is $10, so $50 - $10 = $40, which matches the given discounted price."
249
+ ],
250
+ answer: "The original price of the shirt was $50.",
251
+ reasoning: "This solution correctly interprets percentages and sets up an appropriate equation. The algebraic manipulation is sound, and the verification step confirms the answer's validity. The reasoning shows understanding of the underlying percentage concepts rather than just applying a formula."
252
+ }
253
+ };
254
+
255
+ // Handle solve button click
256
+ solveBtn.addEventListener('click', function() {
257
+ const problem = mathProblemInput.value.trim();
258
+
259
+ if (!problem) {
260
+ alert('Please enter a math problem to solve.');
261
+ return;
262
+ }
263
+
264
+ // Show loading state
265
+ solutionSection.classList.add('show');
266
+ loading.classList.remove('hidden');
267
+ solutionContent.classList.add('hidden');
268
+
269
+ // Simulate API call with timeout
270
+ setTimeout(function() {
271
+ // Hide loading, show content
272
+ loading.classList.add('hidden');
273
+ solutionContent.classList.remove('hidden');
274
+
275
+ // Determine which sample solution to use based on problem content
276
+ let solutionKey = "basic";
277
+ if (problem.includes("fraction") || problem.includes("3/4")) {
278
+ solutionKey = "fraction";
279
+ } else if (problem.includes("%") || problem.includes("percent") || problem.includes("discount")) {
280
+ solutionKey = "percentage";
281
+ }
282
+
283
+ const solution = sampleSolutions[solutionKey];
284
+
285
+ // Populate steps
286
+ stepsContainer.innerHTML = '';
287
+ solution.steps.forEach((step, index) => {
288
+ const stepElement = document.createElement('div');
289
+ stepElement.className = 'step-highlight p-4 rounded-lg';
290
+ stepElement.innerHTML = `
291
+ <div class="flex">
292
+ <span class="flex-shrink-0 bg-purple-600 text-white rounded-full w-6 h-6 flex items-center justify-center mr-3">${index + 1}</span>
293
+ <p>${step}</p>
294
+ </div>
295
+ `;
296
+ stepsContainer.appendChild(stepElement);
297
+ });
298
+
299
+ // Set final answer
300
+ finalAnswer.textContent = solution.answer;
301
+
302
+ // Set alignment reasoning
303
+ alignmentReasoning.textContent = solution.reasoning;
304
+
305
+ // Scroll to solution
306
+ solutionSection.scrollIntoView({ behavior: 'smooth' });
307
+ }, 1500);
308
+ });
309
+
310
+ // Handle feedback buttons
311
+ correctBtn.addEventListener('click', function() {
312
+ feedbackThanks.classList.remove('hidden');
313
+ setTimeout(() => feedbackThanks.classList.add('hidden'), 3000);
314
+ });
315
+
316
+ incorrectBtn.addEventListener('click', function() {
317
+ feedbackThanks.textContent = "We'll review this solution to improve our AI. Thank you!";
318
+ feedbackThanks.className = "hidden mt-3 text-center text-purple-600 font-medium";
319
+ feedbackThanks.classList.remove('hidden');
320
+ setTimeout(() => feedbackThanks.classList.add('hidden'), 3000);
321
+ });
322
+
323
+ // Auto-expand textarea as user types
324
+ mathProblemInput.addEventListener('input', function() {
325
+ this.style.height = 'auto';
326
+ this.style.height = (this.scrollHeight) + 'px';
327
+ });
328
+ });
329
+ </script>
330
+ <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>
331
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Build a professional-looking AI tutoring website called LoopBreakers. The user should be able to input a Year 5–10 maths word problem. The website should have: A clean input box to paste the question. A “Get Solution” button. Below that, a section showing: Step-by-step explanation (from the AI). Final Answer clearly shown. A section titled "Alignment Reasoning" that explains why the steps align with correct reasoning (not reward hacking). Option to rate the solution as “Correct” or “Incorrect”. Modern purple branding and a header saying: LoopBreakers – Reward-Hacking Resistant Math AI Responsive layout with good mobile support.