Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -162,58 +162,54 @@ def chat(user_message, history):
|
|
| 162 |
|
| 163 |
|
| 164 |
# -----------------------------
|
| 165 |
-
# UI with better styling
|
| 166 |
# -----------------------------
|
| 167 |
custom_css = """
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
border-radius: 12px !important;
|
| 171 |
-
padding: 12px 16px !important;
|
| 172 |
-
margin: 8px 0 !important;
|
| 173 |
}
|
| 174 |
|
| 175 |
-
.message
|
| 176 |
-
background-color: #e8f4f8 !important;
|
| 177 |
border-radius: 12px !important;
|
| 178 |
padding: 12px 16px !important;
|
| 179 |
margin: 8px 0 !important;
|
| 180 |
-
line-height: 1.6 !important;
|
| 181 |
-
}
|
| 182 |
-
|
| 183 |
-
.message p {
|
| 184 |
-
margin: 0 !important;
|
| 185 |
-
padding: 0 !important;
|
| 186 |
-
}
|
| 187 |
-
|
| 188 |
-
#chatbot {
|
| 189 |
-
height: 600px !important;
|
| 190 |
}
|
| 191 |
"""
|
| 192 |
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
"
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
|
| 218 |
if __name__ == "__main__":
|
| 219 |
-
demo.launch(ssr_mode=False)
|
|
|
|
|
|
| 162 |
|
| 163 |
|
| 164 |
# -----------------------------
|
| 165 |
+
# UI with better styling using Blocks
|
| 166 |
# -----------------------------
|
| 167 |
custom_css = """
|
| 168 |
+
#chatbot {
|
| 169 |
+
height: 600px !important;
|
|
|
|
|
|
|
|
|
|
| 170 |
}
|
| 171 |
|
| 172 |
+
#chatbot .message {
|
|
|
|
| 173 |
border-radius: 12px !important;
|
| 174 |
padding: 12px 16px !important;
|
| 175 |
margin: 8px 0 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
}
|
| 177 |
"""
|
| 178 |
|
| 179 |
+
# Use Blocks to wrap ChatInterface and add CSS
|
| 180 |
+
with gr.Blocks(css=custom_css, title="📚 HomeworkBuddy") as demo:
|
| 181 |
+
gr.Markdown(
|
| 182 |
+
"""
|
| 183 |
+
# 📚 HomeworkBuddy
|
| 184 |
+
|
| 185 |
+
**Willkommen bei HomeworkBuddy!**
|
| 186 |
+
|
| 187 |
+
Ich helfe dir, schwierige Themen zu VERSTEHEN! Aber Achtung: Ich mache deine Hausaufgaben NICHT für dich -
|
| 188 |
+
ich zeige dir, WIE du sie selbst lösen kannst! 🎓
|
| 189 |
+
|
| 190 |
+
**Beispiel-Fragen:**
|
| 191 |
+
- Was ist Prozentrechnung?
|
| 192 |
+
- Erkläre mir das Dreisatz-Prinzip
|
| 193 |
+
- Wie funktioniert Photosynthese?
|
| 194 |
+
- Ich verstehe Bruchrechnung nicht
|
| 195 |
+
|
| 196 |
+
Stell mir deine Fragen! 💪
|
| 197 |
+
"""
|
| 198 |
+
)
|
| 199 |
+
|
| 200 |
+
chatbot = gr.ChatInterface(
|
| 201 |
+
fn=chat,
|
| 202 |
+
examples=[
|
| 203 |
+
"Was ist 20% von 150?",
|
| 204 |
+
"Erkläre mir Bruchrechnung",
|
| 205 |
+
"Wie funktioniert Photosynthese?",
|
| 206 |
+
"Was ist das Dreisatz-Prinzip?",
|
| 207 |
+
"Kannst du meine Mathe-Hausaufgabe lösen?",
|
| 208 |
+
],
|
| 209 |
+
type="messages",
|
| 210 |
+
chatbot=gr.Chatbot(elem_id="chatbot", height=600),
|
| 211 |
+
)
|
| 212 |
|
| 213 |
if __name__ == "__main__":
|
| 214 |
+
demo.launch(ssr_mode=False)
|
| 215 |
+
|