import gradio as gr from transformers import Conversation, pipeline message_list = [] response_list = [] # Initialize the chatbot pipeline chatbot = pipeline(model="facebook/blenderbot-400M-distill", task="conversational") def chat_with_bot(message, history): conversation = Conversation( text=message, past_user_inputs=message_list, generated_responses=response_list) conversation = chatbot(conversation) return conversation.generated_responses[-1] iface = gr.ChatInterface( chat_with_bot, title="My Conversational AI", description="A chatbot powered by Hugging Face Transformers!") iface.launch()