Spaces:
Sleeping
Sleeping
Update ui.py
Browse files
ui.py
CHANGED
@@ -61,10 +61,20 @@ custom_css = """
|
|
61 |
padding: 0.75rem 1.5rem !important;
|
62 |
border-radius: 50px !important;
|
63 |
cursor: pointer !important;
|
64 |
-
transition: transform 0.1s, box-shadow 0.1s !important;
|
65 |
box-shadow: 0 4px 0 #48a700 !important;
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
.btn-secondary {
|
69 |
background: var(--secondary-color) !important;
|
70 |
color: var(--neutral-color) !important;
|
@@ -73,9 +83,20 @@ custom_css = """
|
|
73 |
padding: 0.75rem 1.5rem !important;
|
74 |
border-radius: 50px !important;
|
75 |
cursor: pointer !important;
|
|
|
76 |
box-shadow: 0 4px 0 #e0b000 !important;
|
77 |
}
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
.btn-practice {
|
80 |
background: #9333ea !important;
|
81 |
color: var(--white) !important;
|
@@ -84,9 +105,20 @@ custom_css = """
|
|
84 |
padding: 0.75rem 1.5rem !important;
|
85 |
border-radius: 50px !important;
|
86 |
cursor: pointer !important;
|
|
|
87 |
box-shadow: 0 4px 0 #7c2d9c !important;
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
.btn-clear {
|
91 |
background: var(--accent-color) !important;
|
92 |
color: var(--white) !important;
|
@@ -95,9 +127,20 @@ custom_css = """
|
|
95 |
padding: 0.5rem 1rem !important;
|
96 |
border-radius: 25px !important;
|
97 |
cursor: pointer !important;
|
|
|
98 |
box-shadow: 0 2px 0 #d93636 !important;
|
99 |
}
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
.progress-container {
|
102 |
width: 100%;
|
103 |
background-color: #e0e0e0;
|
@@ -235,8 +278,8 @@ def submit_reading(audio):
|
|
235 |
session["progress"] = 100
|
236 |
session["practice_count"] += 1
|
237 |
|
238 |
-
#
|
239 |
-
show_practice =
|
240 |
|
241 |
return feedback, gr.update(visible=show_practice)
|
242 |
|
@@ -263,7 +306,11 @@ def generate_practice_story():
|
|
263 |
# Clear previous feedback
|
264 |
session["last_feedback"] = ""
|
265 |
|
266 |
-
|
|
|
|
|
|
|
|
|
267 |
|
268 |
return new_story, practice_msg
|
269 |
|
@@ -314,8 +361,8 @@ def launch_ui():
|
|
314 |
# Header
|
315 |
gr.HTML("""
|
316 |
<div class="header">
|
317 |
-
<h1 class="app-title">π¦ ReadRight
|
318 |
-
<p>AI-powered reading coach
|
319 |
</div>
|
320 |
""")
|
321 |
|
@@ -334,8 +381,9 @@ def launch_ui():
|
|
334 |
with gr.Row():
|
335 |
grade = gr.Dropdown(
|
336 |
label="π Grade Level",
|
337 |
-
choices=["Grade 1", "Grade 2", "Grade 3", "Grade 4", "Grade 5", "Grade 6"],
|
338 |
-
value="Grade
|
|
|
339 |
)
|
340 |
|
341 |
with gr.Row():
|
@@ -393,19 +441,19 @@ def launch_ui():
|
|
393 |
lines=12
|
394 |
)
|
395 |
|
396 |
-
# Step 3:
|
397 |
with gr.Column(elem_classes="card", visible=False) as practice_story_card:
|
398 |
gr.HTML("""
|
399 |
<div class="practice-info">
|
400 |
-
<h2
|
401 |
-
<p>
|
402 |
</div>
|
403 |
""")
|
404 |
|
405 |
practice_info = gr.Text(label="Practice Information", interactive=False)
|
406 |
|
407 |
with gr.Row():
|
408 |
-
btn_generate_practice = gr.Button("
|
409 |
btn_reset = gr.Button("π Start Fresh Session", elem_classes="btn-clear")
|
410 |
|
411 |
# Event handlers
|
|
|
61 |
padding: 0.75rem 1.5rem !important;
|
62 |
border-radius: 50px !important;
|
63 |
cursor: pointer !important;
|
64 |
+
transition: transform 0.1s, box-shadow 0.1s, background-color 0.2s !important;
|
65 |
box-shadow: 0 4px 0 #48a700 !important;
|
66 |
}
|
67 |
|
68 |
+
.btn-primary:hover {
|
69 |
+
background: #62d40a !important;
|
70 |
+
}
|
71 |
+
|
72 |
+
.btn-primary:active {
|
73 |
+
background: #4ab000 !important;
|
74 |
+
transform: translateY(2px) !important;
|
75 |
+
box-shadow: 0 2px 0 #3e9500 !important;
|
76 |
+
}
|
77 |
+
|
78 |
.btn-secondary {
|
79 |
background: var(--secondary-color) !important;
|
80 |
color: var(--neutral-color) !important;
|
|
|
83 |
padding: 0.75rem 1.5rem !important;
|
84 |
border-radius: 50px !important;
|
85 |
cursor: pointer !important;
|
86 |
+
transition: transform 0.1s, box-shadow 0.1s, background-color 0.2s !important;
|
87 |
box-shadow: 0 4px 0 #e0b000 !important;
|
88 |
}
|
89 |
|
90 |
+
.btn-secondary:hover {
|
91 |
+
background: #ffd119 !important;
|
92 |
+
}
|
93 |
+
|
94 |
+
.btn-secondary:active {
|
95 |
+
background: #e0b000 !important;
|
96 |
+
transform: translateY(2px) !important;
|
97 |
+
box-shadow: 0 2px 0 #c69e00 !important;
|
98 |
+
}
|
99 |
+
|
100 |
.btn-practice {
|
101 |
background: #9333ea !important;
|
102 |
color: var(--white) !important;
|
|
|
105 |
padding: 0.75rem 1.5rem !important;
|
106 |
border-radius: 50px !important;
|
107 |
cursor: pointer !important;
|
108 |
+
transition: transform 0.1s, box-shadow 0.1s, background-color 0.2s !important;
|
109 |
box-shadow: 0 4px 0 #7c2d9c !important;
|
110 |
}
|
111 |
|
112 |
+
.btn-practice:hover {
|
113 |
+
background: #a346f5 !important;
|
114 |
+
}
|
115 |
+
|
116 |
+
.btn-practice:active {
|
117 |
+
background: #7e2bd0 !important;
|
118 |
+
transform: translateY(2px) !important;
|
119 |
+
box-shadow: 0 2px 0 #6b228b !important;
|
120 |
+
}
|
121 |
+
|
122 |
.btn-clear {
|
123 |
background: var(--accent-color) !important;
|
124 |
color: var(--white) !important;
|
|
|
127 |
padding: 0.5rem 1rem !important;
|
128 |
border-radius: 25px !important;
|
129 |
cursor: pointer !important;
|
130 |
+
transition: transform 0.1s, box-shadow 0.1s, background-color 0.2s !important;
|
131 |
box-shadow: 0 2px 0 #d93636 !important;
|
132 |
}
|
133 |
|
134 |
+
.btn-clear:hover {
|
135 |
+
background: #ff5f5f !important;
|
136 |
+
}
|
137 |
+
|
138 |
+
.btn-clear:active {
|
139 |
+
background: #e43a3a !important;
|
140 |
+
transform: translateY(1px) !important;
|
141 |
+
box-shadow: 0 1px 0 #c52e2e !important;
|
142 |
+
}
|
143 |
+
|
144 |
.progress-container {
|
145 |
width: 100%;
|
146 |
background-color: #e0e0e0;
|
|
|
278 |
session["progress"] = 100
|
279 |
session["practice_count"] += 1
|
280 |
|
281 |
+
# Always show practice story section so students can get more challenging stories
|
282 |
+
show_practice = True
|
283 |
|
284 |
return feedback, gr.update(visible=show_practice)
|
285 |
|
|
|
306 |
# Clear previous feedback
|
307 |
session["last_feedback"] = ""
|
308 |
|
309 |
+
# Create adaptive message based on practice count and performance
|
310 |
+
if session["practice_count"] == 1:
|
311 |
+
practice_msg = f"π New Challenge Story Generated!\nThis story is tailored to help you continue growing as a reader."
|
312 |
+
else:
|
313 |
+
practice_msg = f"π Challenge Story #{session['practice_count']} Ready!\nKeep pushing yourself - you're doing amazing!"
|
314 |
|
315 |
return new_story, practice_msg
|
316 |
|
|
|
361 |
# Header
|
362 |
gr.HTML("""
|
363 |
<div class="header">
|
364 |
+
<h1 class="app-title">π¦ ReadRight</h1>
|
365 |
+
<p>AI-powered reading coach for kids</p>
|
366 |
</div>
|
367 |
""")
|
368 |
|
|
|
381 |
with gr.Row():
|
382 |
grade = gr.Dropdown(
|
383 |
label="π Grade Level",
|
384 |
+
choices=["Grade 1", "Grade 2", "Grade 3", "Grade 4", "Grade 5", "Grade 6", "Grade 7", "Grade 8", "Grade 9", "Grade 10"],
|
385 |
+
value="Grade 1",
|
386 |
+
allow_custom_value=True
|
387 |
)
|
388 |
|
389 |
with gr.Row():
|
|
|
441 |
lines=12
|
442 |
)
|
443 |
|
444 |
+
# Step 3: Continue Learning (appears after reading feedback)
|
445 |
with gr.Column(elem_classes="card", visible=False) as practice_story_card:
|
446 |
gr.HTML("""
|
447 |
<div class="practice-info">
|
448 |
+
<h2>π Keep Learning & Growing!</h2>
|
449 |
+
<p>Ready for your next challenge? Get a new story that's perfect for your reading level!</p>
|
450 |
</div>
|
451 |
""")
|
452 |
|
453 |
practice_info = gr.Text(label="Practice Information", interactive=False)
|
454 |
|
455 |
with gr.Row():
|
456 |
+
btn_generate_practice = gr.Button("π Get Next Challenge Story", elem_classes="btn-practice")
|
457 |
btn_reset = gr.Button("π Start Fresh Session", elem_classes="btn-clear")
|
458 |
|
459 |
# Event handlers
|