Update app.py
Browse files
app.py
CHANGED
@@ -50,40 +50,6 @@ TOPIC_EXAMPLES = {
|
|
50 |
"What do you think makes a destination culturally significant?",
|
51 |
"Describe your most challenging travel experience."
|
52 |
]
|
53 |
-
},
|
54 |
-
"Food": {
|
55 |
-
"beginner": [
|
56 |
-
"Do you like fruit?",
|
57 |
-
"Whatβs your favorite snack?",
|
58 |
-
"Do you drink tea or coffee?"
|
59 |
-
],
|
60 |
-
"intermediate": [
|
61 |
-
"What's your favorite food?",
|
62 |
-
"Can you describe how to cook a simple dish?",
|
63 |
-
"What did you eat today?"
|
64 |
-
],
|
65 |
-
"advanced": [
|
66 |
-
"How do food choices reflect cultural identity?",
|
67 |
-
"What are your thoughts on sustainable eating?",
|
68 |
-
"Describe a memorable meal and why it stood out."
|
69 |
-
]
|
70 |
-
},
|
71 |
-
"Work & School": {
|
72 |
-
"beginner": [
|
73 |
-
"Do you go to school?",
|
74 |
-
"Do you have a job?",
|
75 |
-
"Do you have homework?"
|
76 |
-
],
|
77 |
-
"intermediate": [
|
78 |
-
"What do you do for work or study?",
|
79 |
-
"Describe your typical workday.",
|
80 |
-
"What subjects do you like or dislike?"
|
81 |
-
],
|
82 |
-
"advanced": [
|
83 |
-
"What are the most important skills in your field?",
|
84 |
-
"How do you manage work-life balance?",
|
85 |
-
"Describe a major accomplishment and how you achieved it."
|
86 |
-
]
|
87 |
}
|
88 |
}
|
89 |
|
@@ -144,28 +110,32 @@ def get_avatar_url():
|
|
144 |
return "https://api.dicebear.com/7.x/bottts/svg?seed=rabbit&backgroundColor=b6e3f4"
|
145 |
|
146 |
custom_css = """
|
147 |
-
.compact-
|
148 |
-
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
151 |
-
.compact-
|
152 |
-
|
153 |
-
display: flex;
|
154 |
-
align-items: center;
|
155 |
}
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
|
|
161 |
}
|
162 |
"""
|
163 |
|
164 |
with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
|
165 |
gr.Markdown("""
|
166 |
# π° JoJo - Your Speaking Buddy
|
167 |
-
**
|
168 |
-
|
169 |
""")
|
170 |
|
171 |
avatar = get_avatar_url()
|
@@ -190,8 +160,14 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
|
|
190 |
submit = gr.Button("Send", variant="primary")
|
191 |
clear = gr.Button("New Chat")
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
with gr.Column(scale=1):
|
194 |
-
gr.Markdown("
|
195 |
topic = gr.Dropdown(
|
196 |
choices=list(TOPIC_EXAMPLES.keys()),
|
197 |
label="Select Topic",
|
@@ -204,7 +180,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
|
|
204 |
value="intermediate"
|
205 |
)
|
206 |
|
207 |
-
gr.Markdown("
|
208 |
starter_btn1 = gr.Button("Starter 1", scale=1, min_width=250, elem_classes="compact-btn")
|
209 |
starter_btn2 = gr.Button("Starter 2", scale=1, min_width=250, elem_classes="compact-btn")
|
210 |
starter_btn3 = gr.Button("Starter 3", scale=1, min_width=250, elem_classes="compact-btn")
|
@@ -239,4 +215,4 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
|
|
239 |
demo.load(fn=lambda: tuple(default_starters[:3]), outputs=starter_buttons, queue=False)
|
240 |
|
241 |
if __name__ == "__main__":
|
242 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
50 |
"What do you think makes a destination culturally significant?",
|
51 |
"Describe your most challenging travel experience."
|
52 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
}
|
55 |
|
|
|
110 |
return "https://api.dicebear.com/7.x/bottts/svg?seed=rabbit&backgroundColor=b6e3f4"
|
111 |
|
112 |
custom_css = """
|
113 |
+
.compact-btn {
|
114 |
+
padding: 0.75rem !important;
|
115 |
+
font-size: 1rem !important;
|
116 |
+
font-weight: 500;
|
117 |
+
border-radius: 8px;
|
118 |
+
background-color: #2f2f2f;
|
119 |
+
color: white;
|
120 |
+
transition: background-color 0.3s;
|
121 |
}
|
122 |
+
.compact-btn:hover {
|
123 |
+
background-color: #444;
|
|
|
|
|
124 |
}
|
125 |
+
#voice-controls {
|
126 |
+
margin-top: 1em;
|
127 |
+
text-align: center;
|
128 |
+
opacity: 0.5;
|
129 |
+
font-size: 0.9rem;
|
130 |
+
font-style: italic;
|
131 |
}
|
132 |
"""
|
133 |
|
134 |
with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
|
135 |
gr.Markdown("""
|
136 |
# π° JoJo - Your Speaking Buddy
|
137 |
+
**Chat in English with JoJo β your kind and cheerful language partner.**
|
138 |
+
Pick a topic, choose your level, and practice naturally. JoJo will guide you, ask questions, and gently correct you along the way!
|
139 |
""")
|
140 |
|
141 |
avatar = get_avatar_url()
|
|
|
160 |
submit = gr.Button("Send", variant="primary")
|
161 |
clear = gr.Button("New Chat")
|
162 |
|
163 |
+
gr.Markdown("""
|
164 |
+
<div id="voice-controls">
|
165 |
+
π€ Voice input and π playback coming soon!
|
166 |
+
</div>
|
167 |
+
""")
|
168 |
+
|
169 |
with gr.Column(scale=1):
|
170 |
+
gr.Markdown("""### π― Conversation Settings""")
|
171 |
topic = gr.Dropdown(
|
172 |
choices=list(TOPIC_EXAMPLES.keys()),
|
173 |
label="Select Topic",
|
|
|
180 |
value="intermediate"
|
181 |
)
|
182 |
|
183 |
+
gr.Markdown("""### π¬ Quick Starters""")
|
184 |
starter_btn1 = gr.Button("Starter 1", scale=1, min_width=250, elem_classes="compact-btn")
|
185 |
starter_btn2 = gr.Button("Starter 2", scale=1, min_width=250, elem_classes="compact-btn")
|
186 |
starter_btn3 = gr.Button("Starter 3", scale=1, min_width=250, elem_classes="compact-btn")
|
|
|
215 |
demo.load(fn=lambda: tuple(default_starters[:3]), outputs=starter_buttons, queue=False)
|
216 |
|
217 |
if __name__ == "__main__":
|
218 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|