| |
| """Copy of text summarization.ipynb |
| |
| Automatically generated by Colab. |
| |
| Original file is located at |
| https://colab.research.google.com/drive/12ph83wSwEKGni2qgQjSRJE-EY0KJs-jL |
| """ |
|
|
|
|
| import gradio as gr |
|
|
| |
| from transformers import pipeline |
|
|
| pipe = pipeline("summarization", model="facebook/bart-large-cnn") |
|
|
| def summarize_text(text): |
| result = pipe(text, max_length=500, min_length=30, do_sample=False) |
| |
| |
| return result |
|
|
|
|
| iface = gr.Interface( |
| fn=summarize_text, |
| inputs = gr.Textbox(lines=4, placeholder="Enter text to summarize..."), |
| outputs = "text", |
| title="Text Summarizer", |
| description="Enter text and get a concise summary.", |
| ) |
|
|
|
|
| iface.launch(share = True) |
|
|
|
|