import gradio as gr from transformers import pipeline generator = pipeline("text-generation", model="distilgpt2") def essay_generation(input_text): # p = f"Write a five-paragraph essay for the following topic:\"{input_text}\"\nKeyword: christmas, halloween\nESSAY:\n" p=input_text return generator(p,max_length=1000) iface = gr.Interface(essay_generation,inputs="text",outputs="text",title='Essay Generator APP',theme = "dark-peach",examples=["what is data science?","What is Natural Language Processing","What is Time series?"], description="This app helps in generating text upto 250 characters.") iface.launch(inline=False)