GH111 commited on
Commit
673420a
1 Parent(s): 51b28a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -23
app.py CHANGED
@@ -1,32 +1,22 @@
1
  import streamlit as st
 
2
 
3
- # Function to generate a message
4
- def generate_message():
5
- return "Hello, this is a generated message!"
6
 
7
- # Main Page
8
  def main():
9
- st.title("Main Page")
10
- st.write("Welcome to the Main Page! Click the buttons below.")
11
 
12
- # Button to open a new page
13
- if st.button("Open New Page"):
14
- open_new_page()
15
 
16
- # Button to generate and show a message
17
- if st.button("Generate Message"):
18
- generate_and_show_message()
19
-
20
- # Function to open a new page
21
- def open_new_page():
22
- st.title("New Page")
23
- st.write("This is the New Page!")
24
-
25
- # Function to generate and show a message
26
- def generate_and_show_message():
27
- message = generate_message()
28
- st.title("Generated Message")
29
- st.write(f"This message was generated: {message}")
30
 
 
31
  if __name__ == "__main__":
32
  main()
 
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: ")
 
14
 
15
+ # Generate response when user enters input
16
+ if user_input:
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()