| | import gradio as gr |
| | from transformers import pipeline |
| |
|
| | summarizer = pipeline("summarization", model="facebook/bart-large-cnn") |
| |
|
| | |
| | def summarize_text(text): |
| | summary = summarizer(text, max_length=100, min_length=30, do_sample=False) |
| | return summary[0]['summary_text'] |
| |
|
| | |
| | iface = gr.Interface( |
| | fn=summarize_text, |
| | inputs=gr.Textbox(lines=5, placeholder="Enter text to summarize..."), |
| | outputs="text", |
| | title="Text Summarization Chatbot", |
| | description="Enter a long text, and the chatbot will generate a concise summary using BART." |
| | ) |
| |
|
| | iface.launch(share=True) |