GH111 commited on
Commit
cf40e74
·
1 Parent(s): 673420a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -5
app.py CHANGED
@@ -1,13 +1,21 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
- # Load Hugging Face chatbot model
5
- chatbot_model = pipeline("conversational", model="alpindale/goliath-120b")
 
 
 
 
 
6
 
7
  # Main Page with Chatbot
8
  def main():
9
- st.title("Virtual Therapist Chatbot")
10
- st.write("Feel free to chat with our virtual therapist!")
 
 
 
11
 
12
  # User input for the chatbot
13
  user_input = st.text_input("You: ")
@@ -17,6 +25,24 @@ def main():
17
  response = chatbot_model(user_input, max_length=50, num_return_sequences=1)[0]['generated_text']
18
  st.text_area("Therapist:", response, height=100)
19
 
20
- # Run the main function
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  if __name__ == "__main__":
22
  main()
 
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
+ # Function to generate a message
5
+ def generate_message():
6
+ return "Hello, this is a generated message!"
7
+
8
+ # Function to load Hugging Face chatbot model
9
+ def load_chatbot_model():
10
+ return pipeline("conversational", model="alpindale/goliath-120b")
11
 
12
  # Main Page with Chatbot
13
  def main():
14
+ st.title("Main Page with Chatbot")
15
+ st.write("Welcome to the Main Page! Type your message to chat with our virtual therapist.")
16
+
17
+ # Load the chatbot model
18
+ chatbot_model = load_chatbot_model()
19
 
20
  # User input for the chatbot
21
  user_input = st.text_input("You: ")
 
25
  response = chatbot_model(user_input, max_length=50, num_return_sequences=1)[0]['generated_text']
26
  st.text_area("Therapist:", response, height=100)
27
 
28
+ # Button to open a new page
29
+ if st.button("Open New Page"):
30
+ open_new_page()
31
+
32
+ # Button to generate and show a message
33
+ if st.button("Generate Message"):
34
+ generate_and_show_message()
35
+
36
+ # Function to open a new page
37
+ def open_new_page():
38
+ st.title("New Page")
39
+ st.write("This is the New Page!")
40
+
41
+ # Function to generate and show a message
42
+ def generate_and_show_message():
43
+ message = generate_message()
44
+ st.title("Generated Message")
45
+ st.write(f"This message was generated: {message}")
46
+
47
  if __name__ == "__main__":
48
  main()