Spaces:
Build error

mliooh commited on
Commit
2e94c5f
·
1 Parent(s): 878af66

update space

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -13,9 +13,9 @@ model = AutoModelForCausalLM.from_pretrained("distilbert/distilgpt2")
13
 
14
  system_message = "You are a compassionate and empathetic mental health chatbot. Your goal is to listen carefully, provide comforting support, and offer helpful guidance to users who are feeling down, anxious, or stressed. Always respond with kindness and understanding, making the user feel safe and heard."
15
 
16
- def get_response(user_prompt):
17
  # combine system_message with user input to form prompt
18
- prompt = f"{system_message}\n\nUser: {user_input}\nBot: "
19
 
20
  # Tokenize and generate a response
21
  inputs = tokenizer.encode(prompt, return_tensors="pt")
@@ -23,6 +23,6 @@ def get_response(user_prompt):
23
 
24
  return tokenizer.decode(outputs[0], skip_special_tokens=True)
25
 
26
- user_input = "I'm feeling really stressed and anxious."
27
- response = generate_response(user_input)
28
  print(response)
 
13
 
14
  system_message = "You are a compassionate and empathetic mental health chatbot. Your goal is to listen carefully, provide comforting support, and offer helpful guidance to users who are feeling down, anxious, or stressed. Always respond with kindness and understanding, making the user feel safe and heard."
15
 
16
+ def generate_response(user_prompt):
17
  # combine system_message with user input to form prompt
18
+ prompt = f"{system_message}\n\nUser: {user_prompt}\nBot: "
19
 
20
  # Tokenize and generate a response
21
  inputs = tokenizer.encode(prompt, return_tensors="pt")
 
23
 
24
  return tokenizer.decode(outputs[0], skip_special_tokens=True)
25
 
26
+ user_prompt = "I'm feeling really stressed and anxious."
27
+ response = generate_response(user_prompt)
28
  print(response)