|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
hub_model_id = "greatdaveo/pegasus-findsum" |
|
summarizer = pipeline("summarization", model=hub_model_id) |
|
def summarize_text(document): |
|
summary = summarizer(document, max_length=150, min_length=30, do_sample=False) |
|
return summary[0]['summary_text'] |
|
iface = gr.Interface( |
|
fn=summarize_text, |
|
inputs=gr.Textbox(lines=10, placeholder="Enter text here..."), |
|
outputs="text", |
|
title="Financial Document Summarizer", |
|
description="Summarize text using the greatdaveo/pegasus-findsum model." |
|
) |
|
iface.launch() |