from transformers import pipeline import gradio as gr # Use the BlenderBot model with the 'text2text-generation' task chatbot = pipeline("text2text-generation", model="facebook/blenderbot-400M-distill") # Function to handle conversation def vanilla_chatbot(message, history): # Generate a response using the chatbot model response = chatbot(message) # Return the generated response return response[0]['generated_text'] # Initialize the Gradio ChatInterface with 'messages' format demo_chatbot = gr.ChatInterface(vanilla_chatbot, title="Vanilla Chatbot", description="Enter text to start chatting.", type="messages") # Launch the Gradio interface with a public link demo_chatbot.launch(share=True)