bChaukar commited on
Commit
0ff587f
·
verified ·
1 Parent(s): 25f3c55

Upload 13 files

Browse files
Files changed (7) hide show
  1. DEPLOYMENT_NOTES.txt +5 -0
  2. assessment.html +19 -0
  3. dashboard.html +30 -6
  4. practice.html +46 -6
  5. rise-frontend.js +50 -0
  6. signin.html +17 -1
  7. signup.html +18 -2
DEPLOYMENT_NOTES.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ RISE FRONTEND PACKAGE (Hugging Face Spaces)
2
+
3
+ Upload these website files to the Hugging Face Space repository. This ZIP intentionally excludes Python backend files, requirements-api.txt, and the Colab notebook.
4
+
5
+ Run RISE_Colab_Integration_Fixed.ipynb separately in Google Colab. Keep the backend folder/files separate. When Colab creates a new Cloudflare tunnel URL, update only the frontend API base URL setting that points to the backend.
assessment.html CHANGED
@@ -299,6 +299,25 @@
299
  confidenceScore
300
  );
301
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
 
303
  // Go to dashboard
304
  window.location.href = "dashboard.html";
 
299
  confidenceScore
300
  );
301
 
302
+ // Persist this assessment in the signed-in browser profile.
303
+ const activeEmail = (localStorage.getItem("riseActiveUserEmail") || "").trim().toLowerCase();
304
+ if (activeEmail) {
305
+ const profileKey = "riseUser:" + activeEmail;
306
+ const profile = JSON.parse(localStorage.getItem(profileKey) || "{}");
307
+ const assessedLevel = Math.min(5, Math.max(1, Number(level) || 1));
308
+ profile.email = activeEmail;
309
+ profile.startingLevel = assessedLevel;
310
+ profile.unlockedLevel = Math.max(Number(profile.unlockedLevel) || assessedLevel, assessedLevel);
311
+ profile.assessmentScore = Number(totalScore) || 0;
312
+ profile.speakingScore = speakingScore;
313
+ profile.conversationScore = conversationScore;
314
+ profile.emotionScore = emotionScore;
315
+ profile.readingScore = readingScore;
316
+ profile.confidenceScore = confidenceScore;
317
+ profile.attempts = Array.isArray(profile.attempts) ? profile.attempts : [];
318
+ profile.sessionsCompleted = Number(profile.sessionsCompleted) || 0;
319
+ localStorage.setItem(profileKey, JSON.stringify(profile));
320
+ }
321
 
322
  // Go to dashboard
323
  window.location.href = "dashboard.html";
dashboard.html CHANGED
@@ -53,12 +53,36 @@
53
 
54
  <footer><div class="logo">RISE</div><p>AI-powered reading and communication assistance.</p><p class="copyright">© 2026 RISE. All rights reserved.</p></footer>
55
  <script>
56
- const startingLevel = Math.min(5, Math.max(1, Number(localStorage.getItem("startingLevel")) || 1));
57
- const levelNames = {1:"Beginner",2:"Elementary",3:"Intermediate",4:"Upper Intermediate",5:"Advanced"};
58
- const levelDescriptions = {1:"Let's build basic reading skills.",2:"Let's strengthen familiar reading skills.",3:"Let's practise connected ideas and varied vocabulary.",4:"Let's develop more complex reading skills.",5:"Let's practise advanced vocabulary and sentence structures."};
59
- document.getElementById("current-level").textContent = "Level " + startingLevel;
60
- document.getElementById("level-description").textContent = levelNames[startingLevel];
61
- document.getElementById("level-message").textContent = "Your suggested starting point is Level " + startingLevel + " — " + levelNames[startingLevel] + ". " + levelDescriptions[startingLevel];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  </script>
63
  </body>
64
  </html>
 
53
 
54
  <footer><div class="logo">RISE</div><p>AI-powered reading and communication assistance.</p><p class="copyright">© 2026 RISE. All rights reserved.</p></footer>
55
  <script>
56
+ (() => {
57
+ const email = (localStorage.getItem("riseActiveUserEmail") || "").trim().toLowerCase();
58
+ const key = email ? "riseUser:" + email : null;
59
+ let profile = key ? JSON.parse(localStorage.getItem(key) || "null") : null;
60
+ if (!profile) {
61
+ const level = 1;
62
+ profile = { startingLevel: level, unlockedLevel: level, attempts: [], sessionsCompleted: 0, averageScore: 0 };
63
+ }
64
+ profile.startingLevel = Math.min(5, Math.max(1, Number(profile.startingLevel) || 1));
65
+ profile.unlockedLevel = Math.min(5, Math.max(profile.startingLevel, Number(profile.unlockedLevel) || profile.startingLevel));
66
+ profile.attempts = Array.isArray(profile.attempts) ? profile.attempts : [];
67
+ const names = {1:"Beginner",2:"Elementary",3:"Intermediate",4:"Upper Intermediate",5:"Advanced"};
68
+ const descriptions = {1:"Let's build basic reading skills.",2:"Let's strengthen familiar reading skills.",3:"Let's practise connected ideas and varied vocabulary.",4:"Let's develop more complex reading skills.",5:"Let's practise advanced vocabulary and sentence structures."};
69
+ document.getElementById("current-level").textContent = "Level " + profile.unlockedLevel;
70
+ document.getElementById("level-description").textContent = names[profile.unlockedLevel];
71
+ document.getElementById("level-message").textContent =
72
+ "Your current level is Level " + profile.unlockedLevel + " — " + names[profile.unlockedLevel] + ". " + descriptions[profile.unlockedLevel] +
73
+ " Levels 1–" + profile.unlockedLevel + " are available; higher levels unlock after you score at least 80% on the story at your current level.";
74
+ const count = document.querySelector(".progress-card:nth-child(2) .progress-number");
75
+ if (count) count.textContent = String(Number(profile.sessionsCompleted) || 0);
76
+ const scores = profile.attempts.map(a => Number(a.overall)).filter(n => Number.isFinite(n));
77
+ const avg = scores.length ? scores.reduce((a,b) => a+b,0) / scores.length : 0;
78
+ profile.averageScore = Math.round(avg * 100) / 100;
79
+ const confidence = document.querySelector(".progress-card:first-child .progress-fill");
80
+ if (confidence) confidence.style.width = Math.max(0, Math.min(100, profile.averageScore)) + "%";
81
+ const confidenceText = document.querySelector(".progress-card:first-child p");
82
+ if (confidenceText) confidenceText.textContent = scores.length ? "Average practice score: " + profile.averageScore + "%" : "No practice attempts recorded yet";
83
+ if (key) localStorage.setItem(key, JSON.stringify(profile));
84
+ document.querySelectorAll(".signin-btn").forEach(link => link.addEventListener("click", () => localStorage.removeItem("riseActiveUserEmail")));
85
+ })();
86
  </script>
87
  </body>
88
  </html>
practice.html CHANGED
@@ -16,6 +16,9 @@
16
  #reading-area{max-width:980px;margin:0 auto 50px;padding:0 18px;display:none}
17
  .back-link{display:inline-block;margin-bottom:20px}
18
  .level-number{font-size:2rem}
 
 
 
19
  </style>
20
  </head>
21
  <body>
@@ -32,12 +35,13 @@
32
  <h1>Choose Your Level</h1>
33
  <p>Select a level to begin. Each level starts with a sentence, then moves to a paragraph and a story when you score at least 80%.</p>
34
  </div>
 
35
  <div class="level-grid">
36
- <article class="level-card"><div class="level-number">🌱</div><h2>Level 1 · Beginner</h2><p>Short sentences and common everyday words.</p><button data-level="beginner">Start Level 1</button></article>
37
- <article class="level-card"><div class="level-number">📘</div><h2>Level 2 · Elementary</h2><p>Familiar vocabulary with a little more detail.</p><button data-level="elementary">Start Level 2</button></article>
38
- <article class="level-card"><div class="level-number">📚</div><h2>Level 3 · Intermediate</h2><p>Longer sentences and connected ideas.</p><button data-level="intermediate">Start Level 3</button></article>
39
- <article class="level-card"><div class="level-number">🎯</div><h2>Level 4 · Upper Intermediate</h2><p>More descriptive vocabulary and complex structures.</p><button data-level="upper_intermediate">Start Level 4</button></article>
40
- <article class="level-card"><div class="level-number">🏆</div><h2>Level 5 · Advanced</h2><p>Advanced vocabulary, nuanced ideas, and varied syntax.</p><button data-level="advanced">Start Level 5</button></article>
41
  </div>
42
  </section>
43
  <section id="reading-area">
@@ -51,9 +55,42 @@
51
  window.RISE_API_BASE = "https://gmbh-highly-travelers-inputs.trycloudflare.com/";
52
  const picker = document.getElementById("level-picker");
53
  const readingArea = document.getElementById("reading-area");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  document.querySelectorAll("[data-level]").forEach(button => {
55
  button.addEventListener("click", () => {
 
 
 
 
 
 
 
56
  window.RISE_SELECTED_LEVEL = button.dataset.level;
 
57
  picker.style.display = "none";
58
  readingArea.style.display = "block";
59
  const container = document.getElementById("rise-reading-app");
@@ -67,7 +104,7 @@
67
 
68
  const script = document.createElement("script");
69
  script.id = "rise-frontend-script";
70
- script.src = "./rise-frontend.js?v=2";
71
 
72
  script.onload = () => {
73
  console.log("RISE frontend script loaded.");
@@ -86,6 +123,9 @@
86
  event.preventDefault();
87
  window.location.href = "practice.html";
88
  });
 
 
 
89
  </script>
90
  </body>
91
  </html>
 
16
  #reading-area{max-width:980px;margin:0 auto 50px;padding:0 18px;display:none}
17
  .back-link{display:inline-block;margin-bottom:20px}
18
  .level-number{font-size:2rem}
19
+ .level-card.locked{opacity:.55;background:#f0f1f5}
20
+ .level-card button:disabled{cursor:not-allowed;background:#7c8495;filter:none}
21
+ .lock-note{font-size:.9rem;color:#8b2635;font-weight:600}
22
  </style>
23
  </head>
24
  <body>
 
35
  <h1>Choose Your Level</h1>
36
  <p>Select a level to begin. Each level starts with a sentence, then moves to a paragraph and a story when you score at least 80%.</p>
37
  </div>
38
+ <p id="level-lock-message" role="status"></p>
39
  <div class="level-grid">
40
+ <article class="level-card" data-level-card="1"><div class="level-number">🌱</div><h2>Level 1 · Beginner</h2><p>Short sentences and common everyday words.</p><button data-level="beginner" data-level-number="1">Start Level 1</button><p class="lock-note" hidden></p></article>
41
+ <article class="level-card" data-level-card="2"><div class="level-number">📘</div><h2>Level 2 · Elementary</h2><p>Familiar vocabulary with a little more detail.</p><button data-level="elementary" data-level-number="2">Start Level 2</button><p class="lock-note" hidden></p></article>
42
+ <article class="level-card" data-level-card="3"><div class="level-number">📚</div><h2>Level 3 · Intermediate</h2><p>Longer sentences and connected ideas.</p><button data-level="intermediate" data-level-number="3">Start Level 3</button><p class="lock-note" hidden></p></article>
43
+ <article class="level-card" data-level-card="4"><div class="level-number">🎯</div><h2>Level 4 · Upper Intermediate</h2><p>More descriptive vocabulary and complex structures.</p><button data-level="upper_intermediate" data-level-number="4">Start Level 4</button><p class="lock-note" hidden></p></article>
44
+ <article class="level-card" data-level-card="5"><div class="level-number">🏆</div><h2>Level 5 · Advanced</h2><p>Advanced vocabulary, nuanced ideas, and varied syntax.</p><button data-level="advanced" data-level-number="5">Start Level 5</button><p class="lock-note" hidden></p></article>
45
  </div>
46
  </section>
47
  <section id="reading-area">
 
55
  window.RISE_API_BASE = "https://gmbh-highly-travelers-inputs.trycloudflare.com/";
56
  const picker = document.getElementById("level-picker");
57
  const readingArea = document.getElementById("reading-area");
58
+ const activeEmail = (localStorage.getItem("riseActiveUserEmail") || "").trim().toLowerCase();
59
+ const profileKey = activeEmail ? "riseUser:" + activeEmail : null;
60
+ let profile = profileKey ? JSON.parse(localStorage.getItem(profileKey) || "null") : null;
61
+ if (!profile) {
62
+ const starting = 1;
63
+ profile = { startingLevel: starting, unlockedLevel: starting, attempts: [], sessionsCompleted: 0 };
64
+ }
65
+ const unlockedLevel = Math.min(5, Math.max(1, Number(profile.unlockedLevel) || Number(profile.startingLevel) || 1));
66
+ document.getElementById("level-lock-message").textContent =
67
+ "Your current level is Level " + unlockedLevel + ". You can access this level and all earlier levels. Score at least 80% on the story to unlock the next level.";
68
+ document.querySelectorAll("[data-level-card]").forEach(card => {
69
+ const n = Number(card.dataset.levelCard);
70
+ const button = card.querySelector("button[data-level]");
71
+ const note = card.querySelector(".lock-note");
72
+ if (n > unlockedLevel) {
73
+ card.classList.add("locked");
74
+ button.disabled = true;
75
+ button.textContent = "🔒 Level Locked";
76
+ note.hidden = false;
77
+ note.textContent = "Score 80% or above on Level " + (n - 1) + " story to unlock.";
78
+ } else {
79
+ button.disabled = false;
80
+ note.hidden = true;
81
+ }
82
+ });
83
  document.querySelectorAll("[data-level]").forEach(button => {
84
  button.addEventListener("click", () => {
85
+ const requested = Number(button.dataset.levelNumber);
86
+ const latest = profileKey ? JSON.parse(localStorage.getItem(profileKey) || "null") : profile;
87
+ const latestUnlocked = Math.min(5, Math.max(1, Number(latest?.unlockedLevel) || unlockedLevel));
88
+ if (requested > latestUnlocked) {
89
+ alert("This level is locked. Score at least 80% on the previous level's story to unlock it.");
90
+ return;
91
+ }
92
  window.RISE_SELECTED_LEVEL = button.dataset.level;
93
+ window.RISE_SELECTED_LEVEL_NUMBER = requested;
94
  picker.style.display = "none";
95
  readingArea.style.display = "block";
96
  const container = document.getElementById("rise-reading-app");
 
104
 
105
  const script = document.createElement("script");
106
  script.id = "rise-frontend-script";
107
+ script.src = "./rise-frontend.js?v=3";
108
 
109
  script.onload = () => {
110
  console.log("RISE frontend script loaded.");
 
123
  event.preventDefault();
124
  window.location.href = "practice.html";
125
  });
126
+ document.querySelectorAll(".signin-btn").forEach(link => link.addEventListener("click", () => {
127
+ localStorage.removeItem("riseActiveUserEmail");
128
+ }));
129
  </script>
130
  </body>
131
  </html>
rise-frontend.js CHANGED
@@ -226,6 +226,54 @@
226
  let stream = null;
227
  let recordingInProgress = false;
228
  let evaluationInProgress = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
 
230
  const setStatus = (message, isError = false) => {
231
  const status = $("rise-status");
@@ -515,6 +563,7 @@
515
  });
516
 
517
  const passed = Boolean(data.passed);
 
518
 
519
  $("rise-feedback").textContent =
520
  `${passed ? "✅ Passed! " : "🔁 Try again. "}` +
@@ -656,6 +705,7 @@
656
  }
657
  );
658
 
 
659
  setStatus(
660
  `Session finished. Attempts: ${data.attempts ?? "N/A"}; ` +
661
  `average overall score: ${data.average_overall ?? "N/A"}%; ` +
 
226
  let stream = null;
227
  let recordingInProgress = false;
228
  let evaluationInProgress = false;
229
+ const activeEmail = (localStorage.getItem("riseActiveUserEmail") || "").trim().toLowerCase();
230
+ const profileKey = activeEmail ? "riseUser:" + activeEmail : null;
231
+
232
+ function loadUserProfile() {
233
+ let profile = profileKey ? JSON.parse(localStorage.getItem(profileKey) || "null") : null;
234
+ if (!profile) {
235
+ const starting = Math.min(5, Math.max(1, Number(localStorage.getItem("startingLevel")) || 1));
236
+ profile = { email: activeEmail, startingLevel: starting, unlockedLevel: starting, attempts: [], sessionsCompleted: 0, averageScore: 0 };
237
+ }
238
+ profile.startingLevel = Math.min(5, Math.max(1, Number(profile.startingLevel) || 1));
239
+ profile.unlockedLevel = Math.min(5, Math.max(profile.startingLevel, Number(profile.unlockedLevel) || profile.startingLevel));
240
+ if (!Array.isArray(profile.attempts)) profile.attempts = [];
241
+ profile.sessionsCompleted = Number(profile.sessionsCompleted) || 0;
242
+ return profile;
243
+ }
244
+
245
+ function saveEvaluationProgress(data) {
246
+ const profile = loadUserProfile();
247
+ const metrics = data.metrics || {};
248
+ const score = Number(metrics.overall);
249
+ profile.attempts.push({
250
+ timestamp: new Date().toISOString(),
251
+ level: data.level || "beginner",
252
+ part: data.part || "sentence",
253
+ overall: Number.isFinite(score) ? score : 0,
254
+ wordAccuracy: Number(metrics.word_accuracy) || 0,
255
+ pronunciation: Number(metrics.pronunciation) || 0,
256
+ completion: Number(metrics.completion) || 0,
257
+ wer: Number(data.wer) || 0,
258
+ passed: Boolean(data.passed)
259
+ });
260
+ // A level unlocks only after its story is passed at >=80%.
261
+ const levelNumbers = { beginner: 1, elementary: 2, intermediate: 3, upper_intermediate: 4, advanced: 5 };
262
+ const completedLevel = levelNumbers[data.level];
263
+ if (data.passed && data.part === "story" && Number(score) >= 80 && completedLevel) {
264
+ profile.unlockedLevel = Math.max(profile.unlockedLevel, Math.min(5, completedLevel + 1));
265
+ }
266
+ const scores = profile.attempts.map(a => Number(a.overall)).filter(Number.isFinite);
267
+ profile.averageScore = scores.length ? Math.round(scores.reduce((sum, n) => sum + n, 0) / scores.length * 100) / 100 : 0;
268
+ if (profileKey) localStorage.setItem(profileKey, JSON.stringify(profile));
269
+ return profile;
270
+ }
271
+
272
+ function saveCompletedSession() {
273
+ const profile = loadUserProfile();
274
+ profile.sessionsCompleted += 1;
275
+ if (profileKey) localStorage.setItem(profileKey, JSON.stringify(profile));
276
+ }
277
 
278
  const setStatus = (message, isError = false) => {
279
  const status = $("rise-status");
 
563
  });
564
 
565
  const passed = Boolean(data.passed);
566
+ saveEvaluationProgress(data);
567
 
568
  $("rise-feedback").textContent =
569
  `${passed ? "✅ Passed! " : "🔁 Try again. "}` +
 
705
  }
706
  );
707
 
708
+ saveCompletedSession();
709
  setStatus(
710
  `Session finished. Attempts: ${data.attempts ?? "N/A"}; ` +
711
  `average overall score: ${data.average_overall ?? "N/A"}%; ` +
signin.html CHANGED
@@ -63,7 +63,23 @@
63
  .addEventListener("submit", function (event) {
64
  event.preventDefault();
65
 
66
- // Demo-only flow: this does not authenticate credentials.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  window.location.href = "/dashboard.html";
68
  });
69
  </script>
 
63
  .addEventListener("submit", function (event) {
64
  event.preventDefault();
65
 
66
+ // This project currently uses demo sign-in (no server-side authentication).
67
+ // Keep progress separated by the email entered on this browser.
68
+ const email = document.getElementById("email").value.trim().toLowerCase();
69
+ if (!email) return;
70
+ localStorage.setItem("riseActiveUserEmail", email);
71
+ const key = "riseUser:" + email;
72
+ if (!localStorage.getItem(key)) {
73
+ const legacyLevel = 1;
74
+ localStorage.setItem(key, JSON.stringify({
75
+ email,
76
+ startingLevel: legacyLevel,
77
+ unlockedLevel: legacyLevel,
78
+ attempts: [],
79
+ sessionsCompleted: 0,
80
+ averageScore: 0
81
+ }));
82
+ }
83
  window.location.href = "/dashboard.html";
84
  });
85
  </script>
signup.html CHANGED
@@ -29,10 +29,10 @@
29
  <form onsubmit="goToAssessment(event)">
30
 
31
  <label>Full Name</label>
32
- <input type="text" placeholder="Enter your full name" required>
33
 
34
  <label>Email Address</label>
35
- <input type="email" placeholder="Enter your email" required>
36
 
37
  <label>Password</label>
38
  <input type="password" placeholder="Create a password" minlength="8" required>
@@ -66,6 +66,22 @@
66
  <script>
67
  function goToAssessment(event) {
68
  event.preventDefault();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  window.location.href = "assessment.html";
70
  }
71
  </script>
 
29
  <form onsubmit="goToAssessment(event)">
30
 
31
  <label>Full Name</label>
32
+ <input id="signup-name" type="text" placeholder="Enter your full name" required>
33
 
34
  <label>Email Address</label>
35
+ <input id="signup-email" type="email" placeholder="Enter your email" required>
36
 
37
  <label>Password</label>
38
  <input type="password" placeholder="Create a password" minlength="8" required>
 
66
  <script>
67
  function goToAssessment(event) {
68
  event.preventDefault();
69
+ const email = document.getElementById("signup-email").value.trim().toLowerCase();
70
+ const name = document.getElementById("signup-name").value.trim();
71
+ if (!email) return;
72
+ localStorage.setItem("riseActiveUserEmail", email);
73
+ const key = "riseUser:" + email;
74
+ const existing = JSON.parse(localStorage.getItem(key) || "null");
75
+ localStorage.setItem(key, JSON.stringify({
76
+ ...(existing || {}),
77
+ email,
78
+ name,
79
+ startingLevel: existing?.startingLevel || 1,
80
+ unlockedLevel: existing?.unlockedLevel || 1,
81
+ attempts: existing?.attempts || [],
82
+ sessionsCompleted: existing?.sessionsCompleted || 0,
83
+ averageScore: existing?.averageScore || 0
84
+ }));
85
  window.location.href = "assessment.html";
86
  }
87
  </script>