Spaces:
Sleeping
Sleeping
import streamlit as st | |
from transformers import pipeline | |
# Set up the Streamlit app | |
st.title("Simple Chatbot") | |
# Initialize the Hugging Face pipeline for conversation | |
chatbot = pipeline("conversational", model="facebook/blenderbot-400M-distill") | |
# Function to handle user input and bot response | |
def get_response(user_input): | |
conversation = chatbot(user_input) | |
response = conversation[0]['generated_text'] | |
return response | |
# Text input for user | |
user_input = st.text_input("You: ", "") | |
# When the user enters text | |
if user_input: | |
response = get_response(user_input) | |
st.write(f"Bot: {response}") | |