import gradio as gr from transformers import pipeline def text_gen(input): generator = pipeline("text-generation", model="distilgpt2") generated_text = generator(input)[0]['generated_text'] # Split the generated text into sentences and concatenate them sentences = generated_text.split('.') full_sentence = ' '.join(sentence.strip() for sentence in sentences if sentence.strip()) return f"'{full_sentence}'" iface = gr.Interface(fn=text_gen, inputs="text", outputs="text") iface.launch()