Spaces:
Sleeping
Sleeping
File size: 616 Bytes
72bf815 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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}")
|