Spaces:
Runtime error
Runtime error
File size: 562 Bytes
cfb03b9 d28a91a cfb03b9 b271f4b c22122c b271f4b d28a91a ca243e2 cfb03b9 b271f4b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import gradio as gr
from transformers import pipeline
from transformers import Conversation
chatbot = pipeline(task="conversational", model="facebook/blenderbot-400M-distill")
conversation = Conversation()
def greet(name, history):
global conversation
if len(history) == 0:
conversation = Conversation()
conversation.add_message({"role": "user",
"content": name})
conversation = chatbot(conversation)
return conversation.messages[len(conversation.messages) -1]['content']
gr.ChatInterface(greet).launch() |