import gradio as gr from transformers import pipeline #hub_model_id = "huggingface-course/mt5-small-finetuned-amazon-en-es" model_id = "philschmid/bart-large-cnn-samsum" #model_id = "t5-base" summarizer = pipeline("summarization", model=model_id) def summarize(text): #return "Summary: " + text out = summarizer(text, max_length=150, min_length = 20) return "Summary: " + str(out) iface = gr.Interface(fn=summarize, inputs="text", outputs="text") iface.launch()