Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -229,74 +229,23 @@ with gr.Blocks(
|
|
229 |
gr.Button("Beispiel-Frage", variant="outline")
|
230 |
with gr.Column(scale=1):
|
231 |
gr.Markdown("### ℹ️ Über Dr. Franz")
|
232 |
-
gr.Markdown("""**Dr. Franz** ist ein experimenteller psychoanalytischer Chatbot
|
233 |
-
• Psychologische Analysen durchführt
|
234 |
-
• Tieferliegende Motive hinterfragt
|
235 |
-
• Provokative Fragen stellt
|
236 |
-
• Emotionale Muster erkennt
|
237 |
-
---
|
238 |
-
**⚠️ Wichtiger Hinweis:**
|
239 |
-
Dieses Tool dient nur der Unterhaltung und dem Experiment. Es ersetzt keine professionelle psychologische Beratung.
|
240 |
-
---
|
241 |
-
**🔧 Technologie:**
|
242 |
-
- HuggingFace Zephyr-7B-Beta
|
243 |
-
- Sentiment-Analyse
|
244 |
-
- Gradio Interface""")
|
245 |
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
# Aktualisiere Chat History
|
262 |
-
history = history or []
|
263 |
-
history.append((message, reply))
|
264 |
-
|
265 |
-
# Speichere für nächste Analyse
|
266 |
-
franz_engine.conversation_memory.append({
|
267 |
-
'input': message,
|
268 |
-
'analysis': analysis,
|
269 |
-
'response': reply
|
270 |
-
})
|
271 |
-
|
272 |
-
return history, ""
|
273 |
-
except Exception as e:
|
274 |
-
error_msg = "Ein technisches Problem ist aufgetreten. Versuchen Sie es erneut."
|
275 |
-
history = history or []
|
276 |
-
history.append((message, error_msg))
|
277 |
-
return history, ""
|
278 |
-
|
279 |
-
def clear_conversation():
|
280 |
-
"""Setzt die Unterhaltung zurück"""
|
281 |
-
global chat_history
|
282 |
-
chat_history = [{"role": "system", "content": SYSTEM_PROMPT}]
|
283 |
-
return [], ""
|
284 |
-
|
285 |
-
# Event-Handler
|
286 |
-
send_btn.click(
|
287 |
-
respond,
|
288 |
-
inputs=[user_input, chatbot],
|
289 |
-
outputs=[chatbot, user_input]
|
290 |
-
)
|
291 |
-
user_input.submit(
|
292 |
-
respond,
|
293 |
-
inputs=[user_input, chatbot],
|
294 |
-
outputs=[chatbot, user_input]
|
295 |
-
)
|
296 |
-
clear_btn.click(
|
297 |
-
clear_conversation,
|
298 |
-
outputs=[chatbot, user_input]
|
299 |
-
)
|
300 |
|
301 |
# === APP-START ===
|
302 |
if __name__ == "__main__":
|
|
|
229 |
gr.Button("Beispiel-Frage", variant="outline")
|
230 |
with gr.Column(scale=1):
|
231 |
gr.Markdown("### ℹ️ Über Dr. Franz")
|
232 |
+
gr.Markdown("""**Dr. Franz** ist ein experimenteller psychoanalytischer Chatbot...""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
|
234 |
+
# === EVENT-HANDLER (MÜSSEN IM BLOCKS-KONTEXT SEIN!) ===
|
235 |
+
send_btn.click(
|
236 |
+
respond,
|
237 |
+
inputs=[user_input, chatbot],
|
238 |
+
outputs=[chatbot, user_input]
|
239 |
+
)
|
240 |
+
user_input.submit(
|
241 |
+
respond,
|
242 |
+
inputs=[user_input, chatbot],
|
243 |
+
outputs=[chatbot, user_input]
|
244 |
+
)
|
245 |
+
clear_btn.click(
|
246 |
+
clear_conversation,
|
247 |
+
outputs=[chatbot, user_input]
|
248 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
|
250 |
# === APP-START ===
|
251 |
if __name__ == "__main__":
|