Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -716,14 +716,15 @@ def update_cards(lang: str, category_choice: str, theme: str, seen: List[str]):
|
|
| 716 |
def get_ui_texts(lang: str) -> Dict[str, Any]:
|
| 717 |
if lang == "fr":
|
| 718 |
header = """
|
| 719 |
-
|
| 720 |
-
|
| 721 |
-
|
| 722 |
-
|
| 723 |
-
|
| 724 |
-
|
| 725 |
-
|
| 726 |
-
|
|
|
|
| 727 |
category_choices = [
|
| 728 |
"alimentation 🍎",
|
| 729 |
"mouvement 🦘",
|
|
@@ -744,14 +745,15 @@ def get_ui_texts(lang: str) -> Dict[str, Any]:
|
|
| 744 |
}
|
| 745 |
else:
|
| 746 |
header = """
|
| 747 |
-
|
| 748 |
-
|
| 749 |
-
|
| 750 |
-
|
| 751 |
-
|
| 752 |
-
</div>
|
| 753 |
</div>
|
| 754 |
-
|
|
|
|
|
|
|
| 755 |
category_choices = [
|
| 756 |
"Nutrition 🍎",
|
| 757 |
"Movement 🦘",
|
|
@@ -774,21 +776,20 @@ def get_ui_texts(lang: str) -> Dict[str, Any]:
|
|
| 774 |
|
| 775 |
def update_ui_language(lang: str):
|
| 776 |
t = get_ui_texts(lang)
|
| 777 |
-
# For text/HTML components we just return new HTML strings.
|
| 778 |
-
# For interactive components (Radio, Button) we use gr.update(...)
|
| 779 |
return (
|
| 780 |
t["header_html"],
|
| 781 |
-
f"<div class='nv-label'>{t['language_label']}</div>",
|
| 782 |
-
f"<div class='nv-label'>{t['theme_label']}</div>",
|
| 783 |
-
f"<div class='nv-label'>{t['category_label']}</div>",
|
| 784 |
-
f"<div class='nv-label'>{t['questions_label']}</div>",
|
| 785 |
-
f"<div class='nv-label'>{t['micro_label']}</div>",
|
| 786 |
gr.update(choices=t["category_choices"], value=t["category_default"]),
|
| 787 |
-
gr.update(value=t[
|
| 788 |
)
|
| 789 |
|
| 790 |
|
| 791 |
|
|
|
|
| 792 |
# ────────────────────────────────────────────────────────────────────────────────
|
| 793 |
# GRADIO APP
|
| 794 |
|
|
@@ -807,25 +808,28 @@ with gr.Blocks(title="Neurovie – Question Studio") as demo:
|
|
| 807 |
|
| 808 |
# Settings
|
| 809 |
with gr.Row(elem_classes="nv-section"):
|
| 810 |
-
|
| 811 |
-
|
| 812 |
-
|
| 813 |
-
|
| 814 |
-
|
| 815 |
-
|
| 816 |
-
|
| 817 |
-
|
| 818 |
-
|
| 819 |
-
|
| 820 |
-
|
| 821 |
-
|
| 822 |
-
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
|
|
|
|
|
|
|
|
|
| 826 |
|
| 827 |
with gr.Column(elem_classes="nv-section"):
|
| 828 |
-
category_label_html = gr.HTML(f"<div class='nv-label'>{ui_texts['category_label']}</div>")
|
| 829 |
category = gr.Radio(
|
| 830 |
choices=ui_texts["category_choices"],
|
| 831 |
value=ui_texts["category_default"],
|
|
@@ -838,14 +842,14 @@ with gr.Blocks(title="Neurovie – Question Studio") as demo:
|
|
| 838 |
# Question & micro-action cards
|
| 839 |
with gr.Row(elem_classes="nv-section"):
|
| 840 |
with gr.Column():
|
| 841 |
-
questions_label_html = gr.HTML(f"<div class='nv-label'>{ui_texts['questions_label']}</div>")
|
| 842 |
with gr.Column(elem_classes="nv-card-grid"):
|
| 843 |
q1 = gr.HTML()
|
| 844 |
q2 = gr.HTML()
|
| 845 |
q3 = gr.HTML()
|
| 846 |
q4 = gr.HTML()
|
| 847 |
with gr.Column():
|
| 848 |
-
micro_label_html = gr.HTML(f"<div class='nv-label'>{ui_texts['micro_label']}</div>")
|
| 849 |
with gr.Column(elem_classes="nv-card-grid"):
|
| 850 |
m1 = gr.HTML()
|
| 851 |
m2 = gr.HTML()
|
|
@@ -864,6 +868,7 @@ with gr.Blocks(title="Neurovie – Question Studio") as demo:
|
|
| 864 |
category,
|
| 865 |
btn,
|
| 866 |
],
|
|
|
|
| 867 |
)
|
| 868 |
|
| 869 |
btn.click(
|
|
|
|
| 716 |
def get_ui_texts(lang: str) -> Dict[str, Any]:
|
| 717 |
if lang == "fr":
|
| 718 |
header = """
|
| 719 |
+
<div class="nv-fade">
|
| 720 |
+
<div class="nv-badge">NEUROVIE · FINGER</div>
|
| 721 |
+
<div class="nv-title">Question Studio</div>
|
| 722 |
+
<div class="nv-subtitle">
|
| 723 |
+
Questions minimalistes pour conversations riches — 4 questions et 2 micro-actions par tirage.
|
| 724 |
+
</div>
|
| 725 |
+
</div>
|
| 726 |
+
"""
|
| 727 |
+
|
| 728 |
category_choices = [
|
| 729 |
"alimentation 🍎",
|
| 730 |
"mouvement 🦘",
|
|
|
|
| 745 |
}
|
| 746 |
else:
|
| 747 |
header = """
|
| 748 |
+
<div class="nv-fade">
|
| 749 |
+
<div class="nv-badge">NEUROVIE · FINGER</div>
|
| 750 |
+
<div class="nv-title">Question Studio</div>
|
| 751 |
+
<div class="nv-subtitle">
|
| 752 |
+
Minimal prompts for rich conversations — 4 questions and 2 micro-actions per draw.
|
|
|
|
| 753 |
</div>
|
| 754 |
+
</div>
|
| 755 |
+
"""
|
| 756 |
+
|
| 757 |
category_choices = [
|
| 758 |
"Nutrition 🍎",
|
| 759 |
"Movement 🦘",
|
|
|
|
| 776 |
|
| 777 |
def update_ui_language(lang: str):
|
| 778 |
t = get_ui_texts(lang)
|
|
|
|
|
|
|
| 779 |
return (
|
| 780 |
t["header_html"],
|
| 781 |
+
f"<div class='nv-label nv-fade'>{t['language_label']}</div>",
|
| 782 |
+
f"<div class='nv-label nv-fade'>{t['theme_label']}</div>",
|
| 783 |
+
f"<div class='nv-label nv-fade'>{t['category_label']}</div>",
|
| 784 |
+
f"<div class='nv-label nv-fade'>{t['questions_label']}</div>",
|
| 785 |
+
f"<div class='nv-label nv-fade'>{t['micro_label']}</div>",
|
| 786 |
gr.update(choices=t["category_choices"], value=t["category_default"]),
|
| 787 |
+
gr.update(value=t['button_text']),
|
| 788 |
)
|
| 789 |
|
| 790 |
|
| 791 |
|
| 792 |
+
|
| 793 |
# ────────────────────────────────────────────────────────────────────────────────
|
| 794 |
# GRADIO APP
|
| 795 |
|
|
|
|
| 808 |
|
| 809 |
# Settings
|
| 810 |
with gr.Row(elem_classes="nv-section"):
|
| 811 |
+
# Language: 1/3
|
| 812 |
+
with gr.Column(scale=1):
|
| 813 |
+
lang_label_html = gr.HTML(f"<div class='nv-label nv-fade'>{ui_texts['language_label']}</div>")
|
| 814 |
+
lang = gr.Radio(
|
| 815 |
+
choices=["fr", "en"],
|
| 816 |
+
value="fr",
|
| 817 |
+
show_label=False,
|
| 818 |
+
elem_classes="nv-pills",
|
| 819 |
+
)
|
| 820 |
+
# Theme: 2/3
|
| 821 |
+
with gr.Column(scale=2):
|
| 822 |
+
theme_label_html = gr.HTML(f"<div class='nv-label nv-fade'>{ui_texts['theme_label']}</div>")
|
| 823 |
+
theme = gr.Radio(
|
| 824 |
+
choices=THEME_KEYS,
|
| 825 |
+
value="family",
|
| 826 |
+
show_label=False,
|
| 827 |
+
elem_classes="nv-pills",
|
| 828 |
+
)
|
| 829 |
+
|
| 830 |
|
| 831 |
with gr.Column(elem_classes="nv-section"):
|
| 832 |
+
category_label_html = gr.HTML(f"<div class='nv-label nv-fade'>{ui_texts['category_label']}</div>")
|
| 833 |
category = gr.Radio(
|
| 834 |
choices=ui_texts["category_choices"],
|
| 835 |
value=ui_texts["category_default"],
|
|
|
|
| 842 |
# Question & micro-action cards
|
| 843 |
with gr.Row(elem_classes="nv-section"):
|
| 844 |
with gr.Column():
|
| 845 |
+
questions_label_html = gr.HTML(f"<div class='nv-label nv-fade'>{ui_texts['questions_label']}</div>")
|
| 846 |
with gr.Column(elem_classes="nv-card-grid"):
|
| 847 |
q1 = gr.HTML()
|
| 848 |
q2 = gr.HTML()
|
| 849 |
q3 = gr.HTML()
|
| 850 |
q4 = gr.HTML()
|
| 851 |
with gr.Column():
|
| 852 |
+
micro_label_html = gr.HTML(f"<div class='nv-label nv-fade'>{ui_texts['micro_label']}</div>")
|
| 853 |
with gr.Column(elem_classes="nv-card-grid"):
|
| 854 |
m1 = gr.HTML()
|
| 855 |
m2 = gr.HTML()
|
|
|
|
| 868 |
category,
|
| 869 |
btn,
|
| 870 |
],
|
| 871 |
+
show_progress=False
|
| 872 |
)
|
| 873 |
|
| 874 |
btn.click(
|