|
|
|
!pip install transformers |
|
|
|
import streamlit as st |
|
from transformers import pipeline |
|
|
|
|
|
def load_model(): |
|
return pipeline("conversational", model="alpindale/goliath-120b") |
|
|
|
|
|
def page_welcome(): |
|
st.title("Welcome to Your Virtual Therapist") |
|
st.write("Feel free to chat with our virtual therapist!") |
|
|
|
|
|
chatbot_model = load_model() |
|
|
|
user_input = st.text_input("You: ") |
|
if user_input: |
|
response = chatbot_model(user_input, max_length=50, num_return_sequences=1)[0]['generated_text'] |
|
st.text_area("Therapist:", response, height=100) |
|
|
|
|
|
def page_journaling(): |
|
st.title("Journaling Session") |
|
st.write("Answer the following questions based on your preferences:") |
|
|
|
|
|
journaling_question = st.text_area("Question:", "How was your day?") |
|
|
|
|
|
|
|
|
|
def page_breathing_exercises(): |
|
st.title("Breathing Exercises") |
|
st.write("Start your meditation with the breathing exercise timer:") |
|
|
|
|
|
|
|
|
|
def main(): |
|
st.sidebar.title("Navigation") |
|
selection = st.sidebar.radio("Go to", ["Welcome & Chatbot", "Journaling", "Breathing Exercises"]) |
|
|
|
if selection == "Welcome & Chatbot": |
|
page_welcome() |
|
elif selection == "Journaling": |
|
page_journaling() |
|
elif selection == "Breathing Exercises": |
|
page_breathing_exercises() |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|