from transformers import pipeline, Conversation import gradio as gr chatbot = pipeline(model="facebook/blenderbot-400M-distill", task="conversational") message_list = [] response_list = [] def Stark_chatbot(message, history): global message_list, response_list message_list.append(message) conversation = Conversation(text=message, past_user_inputs=message_list[:-1], generated_responses=response_list) conversation = chatbot(conversation) reply = conversation.generated_responses[-1] response_list.append(reply) return reply demo_chatbot = gr.ChatInterface(Stark_chatbot, title="Stark Chatbot", description="Enter text to start chatting.") demo_chatbot.launch()