Spaces:
Runtime error
Runtime error
Commit ·
fbfe273
1
Parent(s): 34af5a1
Update app.py
Browse files
app.py
CHANGED
|
@@ -60,6 +60,7 @@ def analyze_history(history):
|
|
| 60 |
return "curious"
|
| 61 |
|
| 62 |
|
|
|
|
| 63 |
# Load the tokenizer and model
|
| 64 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 65 |
model = AutoModelForCausalLM.from_pretrained(
|
|
@@ -80,8 +81,8 @@ def chat(input_text):
|
|
| 80 |
conversation_history.append(f"User: {input_text}")
|
| 81 |
|
| 82 |
# Limit the size of the conversation history
|
| 83 |
-
if len(conversation_history) >
|
| 84 |
-
conversation_history = conversation_history[-
|
| 85 |
|
| 86 |
# Update current emotion based on conversation history
|
| 87 |
current_emotion = analyze_history(conversation_history)
|
|
|
|
| 60 |
return "curious"
|
| 61 |
|
| 62 |
|
| 63 |
+
|
| 64 |
# Load the tokenizer and model
|
| 65 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 66 |
model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
| 81 |
conversation_history.append(f"User: {input_text}")
|
| 82 |
|
| 83 |
# Limit the size of the conversation history
|
| 84 |
+
if len(conversation_history) > 15:
|
| 85 |
+
conversation_history = conversation_history[-15:]
|
| 86 |
|
| 87 |
# Update current emotion based on conversation history
|
| 88 |
current_emotion = analyze_history(conversation_history)
|