from transformers import pipeline import gradio as gr summarizer = pipeline("summarization", model="t5-base", tokenizer="t5-small", framework="tf") def translate(text): text = text.replace("\n", "") text = text.replace("\r", "") text = text.replace(" ", "") text = text.replace("&", "") text = text.replace("'", "") text = text.replace(""", "") result = summarizer(text, min_length=99, tructation=True, max_length=200) return result[-1]['summary_text'] iface = gr.Interface( fn=translate, inputs=gr.inputs.Textbox(lines=9, label="Text", placeholder="Enter text here..."), outputs="text" ) iface.launch()