import gradio as gr from transformers import pipeline def greet(input): generator = pipeline("text-generation", model="distilgpt2") generated_text = generator(input)[0]['generated_text'] # Extract the first sentence and format it first_sentence = generated_text.split('.')[0].strip() return f"'{first_sentence}'" iface = gr.Interface(fn=greet, inputs="text", outputs="text") iface.launch()