File size: 1,417 Bytes
e36951d 673420a e36951d cf40e74 e36951d 673420a 51b28a6 cf40e74 e36951d 673420a e36951d 673420a e36951d cf40e74 08185a7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
import streamlit as st
from transformers import pipeline
# Function to generate a message
def generate_message():
return "Hello, this is a generated message!"
# Function to load Hugging Face chatbot model
def load_chatbot_model():
return pipeline("conversational", model="alpindale/goliath-120b")
# Main Page with Chatbot
def main():
st.title("Main Page with Chatbot")
st.write("Welcome to the Main Page! Type your message to chat with our virtual therapist.")
# Load the chatbot model
chatbot_model = load_chatbot_model()
# User input for the chatbot
user_input = st.text_input("You: ")
# Generate response when user enters input
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)
# Button to open a new page
if st.button("Open New Page"):
open_new_page()
# Button to generate and show a message
if st.button("Generate Message"):
generate_and_show_message()
# Function to open a new page
def open_new_page():
st.title("New Page")
st.write("This is the New Page!")
# Function to generate and show a message
def generate_and_show_message():
message = generate_message()
st.title("Generated Message")
st.write(f"This message was generated: {message}")
if __name__ == "__main__":
main()
|