Spaces:
Runtime error
Runtime error
Trail2 app.py
Browse files
app.py
CHANGED
|
@@ -68,8 +68,7 @@ def memory_chat(user_input, person_name):
|
|
| 68 |
history = memory_db[name]["history"]
|
| 69 |
past_text = "\n\n".join([f"- {h['message']}\n -> {h['interpretation']}" for h in history])
|
| 70 |
|
| 71 |
-
chat_prompt = f"""You are a
|
| 72 |
-
Here is the message history:\n{past_text}\n\nUser asks: {user_input}\n\nGive a thoughtful answer using patterns or emotional tone from the past history."""
|
| 73 |
|
| 74 |
response = interpreter(chat_prompt, max_new_tokens=200)[0]["generated_text"]
|
| 75 |
return response
|
|
@@ -114,4 +113,4 @@ with gr.Blocks(title="Textual Chemistry") as app:
|
|
| 114 |
chatbot_btn = gr.Button("Ask Memory Bot")
|
| 115 |
chatbot_btn.click(fn=memory_chat, inputs=[chatbot_input, person_name], outputs=chatbot_output)
|
| 116 |
|
| 117 |
-
app.launch()
|
|
|
|
| 68 |
history = memory_db[name]["history"]
|
| 69 |
past_text = "\n\n".join([f"- {h['message']}\n -> {h['interpretation']}" for h in history])
|
| 70 |
|
| 71 |
+
chat_prompt = f"""You are a relationship and social communication expert.\n\nYou remember all past messages and responses exchanged with {name}.\nThis is the known message history:\n{past_text}\n\nNow the user wants to understand more about what {name} might be thinking or feeling deep down,\nbased on what they've said before and how they usually act.\n\nUser’s question: {user_input}\n\nUse what you know from the history to infer hidden meaning, emotional tone, and behavior patterns.\nGive a thoughtful and emotionally intelligent answer. Avoid repeating the user's feelings."""
|
|
|
|
| 72 |
|
| 73 |
response = interpreter(chat_prompt, max_new_tokens=200)[0]["generated_text"]
|
| 74 |
return response
|
|
|
|
| 113 |
chatbot_btn = gr.Button("Ask Memory Bot")
|
| 114 |
chatbot_btn.click(fn=memory_chat, inputs=[chatbot_input, person_name], outputs=chatbot_output)
|
| 115 |
|
| 116 |
+
app.launch()
|