# Use a pipeline as a high-level helper from transformers import pipeline, Conversation import gradio as gr chatbot = pipeline("conversational", model="ericzhou/DialoGPT-Medium-Rick_v2") def predict(sentence,history) : conversation = Conversation() for hist in history: conversation.add_user_input(hist[0]) conversation.append_response(hist[1]) conversation.add_user_input(sentence) conversation = chatbot(conversation) return conversation.generated_responses[-1] header = """