Spaces:
Running
Running
better multilingual support
Browse files- src/learnbee/theme.py +76 -0
- src/learnbee/ui.py +20 -16
src/learnbee/theme.py
CHANGED
|
@@ -581,5 +581,81 @@ label {
|
|
| 581 |
padding: 1.25rem;
|
| 582 |
}
|
| 583 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 584 |
"""
|
| 585 |
|
|
|
|
| 581 |
padding: 1.25rem;
|
| 582 |
}
|
| 583 |
}
|
| 584 |
+
|
| 585 |
+
/* Multilingual footer (full-width) - centered and high-contrast for dark/light */
|
| 586 |
+
.multilingual-footer {
|
| 587 |
+
width: 100%;
|
| 588 |
+
padding: 1rem 1.25rem;
|
| 589 |
+
margin-top: 1.25rem;
|
| 590 |
+
border-top: 1px solid rgba(226,232,240,0.6);
|
| 591 |
+
background: linear-gradient(90deg, #f8fafc 0%, #eef2ff 100%);
|
| 592 |
+
color: #0f172a;
|
| 593 |
+
text-align: center;
|
| 594 |
+
}
|
| 595 |
+
.multilingual-footer > div {
|
| 596 |
+
max-width: 1100px;
|
| 597 |
+
margin: 0 auto;
|
| 598 |
+
}
|
| 599 |
+
.multilingual-footer .multilingual-row {
|
| 600 |
+
display: flex;
|
| 601 |
+
align-items: center;
|
| 602 |
+
justify-content: center;
|
| 603 |
+
gap: 0.75rem;
|
| 604 |
+
flex-wrap: wrap;
|
| 605 |
+
}
|
| 606 |
+
.multilingual-footer .multilingual-title {
|
| 607 |
+
font-weight: 700;
|
| 608 |
+
font-size: 1.05rem;
|
| 609 |
+
}
|
| 610 |
+
.multilingual-footer .multilingual-desc {
|
| 611 |
+
opacity: 0.9;
|
| 612 |
+
}
|
| 613 |
+
|
| 614 |
+
/* Dark mode adjustments */
|
| 615 |
+
.dark .multilingual-footer {
|
| 616 |
+
background: linear-gradient(90deg, #0b1220 0%, #081226 100%);
|
| 617 |
+
color: #e6eef8;
|
| 618 |
+
border-top-color: rgba(51,65,85,0.6);
|
| 619 |
+
}
|
| 620 |
+
|
| 621 |
+
/* Center the main container content while keeping form inputs left-aligned for usability */
|
| 622 |
+
.gradio-container {
|
| 623 |
+
text-align: center !important;
|
| 624 |
+
}
|
| 625 |
+
.gr-label, .gr-input, .gr-dropdown, .gr-textbox, .gr-number {
|
| 626 |
+
text-align: left !important;
|
| 627 |
+
}
|
| 628 |
+
|
| 629 |
+
/* Ensure cards and containers are centered within the page */
|
| 630 |
+
.welcome-card, .info-box, .column-container, .chat-container {
|
| 631 |
+
margin-left: auto !important;
|
| 632 |
+
margin-right: auto !important;
|
| 633 |
+
}
|
| 634 |
+
|
| 635 |
+
/* Footer fine-tuning: center icon + title and unify reset text size */
|
| 636 |
+
.multilingual-footer .multilingual-icon {
|
| 637 |
+
font-size: 1.6rem;
|
| 638 |
+
display: inline-block;
|
| 639 |
+
}
|
| 640 |
+
.multilingual-footer .multilingual-content {
|
| 641 |
+
min-width: 280px;
|
| 642 |
+
text-align: center;
|
| 643 |
+
}
|
| 644 |
+
.multilingual-footer .multilingual-title {
|
| 645 |
+
font-size: 1.05rem;
|
| 646 |
+
font-weight: 700;
|
| 647 |
+
margin-bottom: 0.15rem;
|
| 648 |
+
}
|
| 649 |
+
.multilingual-footer .multilingual-desc {
|
| 650 |
+
font-size: 0.95rem;
|
| 651 |
+
opacity: 0.92;
|
| 652 |
+
}
|
| 653 |
+
.multilingual-footer .multilingual-reset {
|
| 654 |
+
font-size: 0.95rem;
|
| 655 |
+
opacity: 0.92;
|
| 656 |
+
}
|
| 657 |
+
.multilingual-footer .multilingual-reset-wrap {
|
| 658 |
+
margin-left: 0.5rem;
|
| 659 |
+
}
|
| 660 |
"""
|
| 661 |
|
src/learnbee/ui.py
CHANGED
|
@@ -166,23 +166,9 @@ def create_gradio_ui():
|
|
| 166 |
outputs=[selected_tutor],
|
| 167 |
)
|
| 168 |
|
| 169 |
-
#
|
| 170 |
with gr.Row():
|
| 171 |
-
gr.HTML(""
|
| 172 |
-
<div class="multilingual-card">
|
| 173 |
-
<div class="multilingual-header">
|
| 174 |
-
<span class="multilingual-icon">π</span>
|
| 175 |
-
<h3 class="multilingual-title">Multilingual Support</h3>
|
| 176 |
-
</div>
|
| 177 |
-
<p class="multilingual-text">
|
| 178 |
-
The tutor automatically responds in your language! Chat in English, Spanish, French, or any language you prefer.
|
| 179 |
-
</p>
|
| 180 |
-
<div class="multilingual-note">
|
| 181 |
-
<span class="note-icon">π</span>
|
| 182 |
-
<span class="note-text">Can't change lesson or tutor while chatting? Use the reset button to start fresh!</span>
|
| 183 |
-
</div>
|
| 184 |
-
</div>
|
| 185 |
-
""")
|
| 186 |
|
| 187 |
with gr.Column(scale=2):
|
| 188 |
# Chat interface - defined before use
|
|
@@ -345,5 +331,23 @@ def create_gradio_ui():
|
|
| 345 |
)
|
| 346 |
btn.click(get_lesson_content, [lesson_name_input, lesson_len], lesson_content_output)
|
| 347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 348 |
return demo
|
| 349 |
|
|
|
|
| 166 |
outputs=[selected_tutor],
|
| 167 |
)
|
| 168 |
|
| 169 |
+
# Spacer where the multilingual card used to be (moved to footer)
|
| 170 |
with gr.Row():
|
| 171 |
+
gr.HTML('<div style="height:0.5rem;"></div>')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
with gr.Column(scale=2):
|
| 174 |
# Chat interface - defined before use
|
|
|
|
| 331 |
)
|
| 332 |
btn.click(get_lesson_content, [lesson_name_input, lesson_len], lesson_content_output)
|
| 333 |
|
| 334 |
+
# Footer: Multilingual Support (full-width)
|
| 335 |
+
gr.HTML("""
|
| 336 |
+
<footer class="multilingual-footer">
|
| 337 |
+
<div>
|
| 338 |
+
<div class="multilingual-row">
|
| 339 |
+
<span class="multilingual-icon" aria-hidden="true">π</span>
|
| 340 |
+
<div class="multilingual-content">
|
| 341 |
+
<div class="multilingual-title">Multilingual Support</div>
|
| 342 |
+
<div class="multilingual-desc">The tutor automatically responds in your language. Chat in Spanish, English, French, or any language you prefer.</div>
|
| 343 |
+
</div>
|
| 344 |
+
<div class="multilingual-reset-wrap">
|
| 345 |
+
<small class="multilingual-reset">π Use the 'Reset' button to change lesson or tutor during a session.</small>
|
| 346 |
+
</div>
|
| 347 |
+
</div>
|
| 348 |
+
</div>
|
| 349 |
+
</footer>
|
| 350 |
+
""")
|
| 351 |
+
|
| 352 |
return demo
|
| 353 |
|