from transformers import pipeline import gradio as gr #model model = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") #model="sshleifer/distilbart-cnn-12-6") def func(article): article_length = article.split() words = len(article_length) if words>900: return "Oops!😰, I can't summarize text that long, please shorten the text🥺" else: return (model(article, max_length=100, do_sample=False)) app = gr.Interface(fn=func, inputs="textbox", outputs="textbox", title="InfluencerAI-Summarizer") app.launch()