Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -38,8 +38,11 @@ if 'previous_responses' not in st.session_state:
|
|
38 |
|
39 |
# Check if user has entered text
|
40 |
if user_input:
|
|
|
|
|
|
|
41 |
# Run the text generation model to generate a response based on user input
|
42 |
-
generated_responses = generator(
|
43 |
|
44 |
# Filter out any responses that are too similar to previous responses or user input
|
45 |
new_responses = [response['generated_text'] for response in generated_responses]
|
|
|
38 |
|
39 |
# Check if user has entered text
|
40 |
if user_input:
|
41 |
+
# Refined prompt for better empathetic responses
|
42 |
+
prompt = f"The user is expressing their feelings of grief, loss, or overwhelm. Respond with empathy and support. User's input: {user_input}"
|
43 |
+
|
44 |
# Run the text generation model to generate a response based on user input
|
45 |
+
generated_responses = generator(prompt, max_length=250, num_return_sequences=3, temperature=0.7)
|
46 |
|
47 |
# Filter out any responses that are too similar to previous responses or user input
|
48 |
new_responses = [response['generated_text'] for response in generated_responses]
|