Spaces:
Sleeping
Sleeping
| from transformers import pipeline | |
| import gradio as gr | |
| model = pipeline("summarization", model="gsasikiran/bart-base-finetuned-cnn", tokenizer="facebook/bart-base") | |
| title = "Article summarizer" | |
| description = "Generate summaries for articles based on the input text." | |
| article = "" | |
| def generate_summary(text): | |
| summary_text = model(text)[0]['summary_text'] | |
| summary_text = summary_text.replace("\n", " ") | |
| return summary_text | |
| hf = gr.Interface( | |
| fn=generate_summary, | |
| inputs=gr.Textbox(lines=5, label="Input Text"), | |
| title=title, | |
| description=description, | |
| article=article, | |
| outputs = gr.Textbox(lines=2, label="Title") | |
| ) | |
| hf.launch() |