tahirsher commited on
Commit
c207ffc
·
verified ·
1 Parent(s): fe6ceec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import streamlit as st
2
  #from transformers import AutoTokenizer
3
- from llama_cpp import Llama
4
  from transformers import pipeline
5
  #from peft import PeftModel, PeftConfig
6
  #from transformers import AutoModelForCausalLM
@@ -51,7 +51,7 @@ st.markdown('<div class="blurred-background"></div>', unsafe_allow_html=True)
51
  @st.cache_resource
52
  def load_text_generation_model():
53
  try:
54
- return pipeline("text-generation", model="thrishala/mental_health_chatbot")
55
  except Exception as e:
56
  st.error(f"Error loading model: {e}")
57
  return None
@@ -69,7 +69,7 @@ dataset = load_counseling_dataset()
69
  st.title("Mental Health Counseling Chat")
70
  st.markdown("""
71
  Welcome to the **Mental Health Counseling Chat Application**.
72
- This platform is designed to provide **supportive, positive, and encouraging responses** based on mental health counseling expertise.
73
  """)
74
 
75
  # Check if the model loaded correctly
@@ -95,7 +95,7 @@ else:
95
  response = text_generator(prompt, max_length=200, num_return_sequences=1)
96
 
97
  # Extract and display the response
98
- counselor_reply = response[0]["generated_text"].split("Counselor:")[-1].strip()
99
  st.subheader("Counselor's Response:")
100
  st.write(counselor_reply)
101
  except Exception as e:
@@ -111,6 +111,4 @@ else:
111
  - [National Suicide Prevention Lifeline](https://suicidepreventionlifeline.org)
112
  """)
113
 
114
- st.sidebar.info("This application is not a replacement for professional counseling. If you are in crisis, please seek professional help immediately.")
115
-
116
-
 
1
  import streamlit as st
2
  #from transformers import AutoTokenizer
3
+ #from llama_cpp import Llama
4
  from transformers import pipeline
5
  #from peft import PeftModel, PeftConfig
6
  #from transformers import AutoModelForCausalLM
 
51
  @st.cache_resource
52
  def load_text_generation_model():
53
  try:
54
+ return pipeline("text-generation", model="google/gemma-2-9b-it")
55
  except Exception as e:
56
  st.error(f"Error loading model: {e}")
57
  return None
 
69
  st.title("Mental Health Counseling Chat")
70
  st.markdown("""
71
  Welcome to the **Mental Health Counseling Chat Application**.
72
+ This platform is designed to provide **supportive, positive, and encouraging responses** using a fast and efficient language model.
73
  """)
74
 
75
  # Check if the model loaded correctly
 
95
  response = text_generator(prompt, max_length=200, num_return_sequences=1)
96
 
97
  # Extract and display the response
98
+ counselor_reply = response[0]["generated_text"].strip()
99
  st.subheader("Counselor's Response:")
100
  st.write(counselor_reply)
101
  except Exception as e:
 
111
  - [National Suicide Prevention Lifeline](https://suicidepreventionlifeline.org)
112
  """)
113
 
114
+ st.sidebar.info("This application is not a replacement for professional counseling. If you are in crisis, please seek professional help immediately.")