import gradio as gr from transformers import pipeline dialogpt = pipeline("text-generation", model="microsoft/DialoGPT-medium") def respond(context): response = dialogpt(context, max_length=100, do_sample=True) return response[0]['generated_text'][len(context):] iface = gr.Interface(fn=respond, inputs="text", outputs="text") iface.launch()