Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,22 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
-
#
|
4 |
-
|
5 |
-
return "Hello, this is a generated message!"
|
6 |
|
7 |
-
# Main Page
|
8 |
def main():
|
9 |
-
st.title("
|
10 |
-
st.write("
|
11 |
|
12 |
-
#
|
13 |
-
|
14 |
-
open_new_page()
|
15 |
|
16 |
-
#
|
17 |
-
if
|
18 |
-
|
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()
|