Spaces:
Sleeping
Sleeping
Adding text summarizer
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
summarizer = pipeline("summarization", model = "facebook/bart-large-cnn")
|
5 |
+
|
6 |
+
def get_summary(input):
|
7 |
+
output = summarizer(input)
|
8 |
+
return output[0]["summary_text"]
|
9 |
+
|
10 |
+
demo = gr.Blocks()
|
11 |
+
with demo:
|
12 |
+
textbox = gr.TextBox(placeholder="Enter text to summarize...", lines=4)
|
13 |
+
btn = gr.Button("Summarize")
|
14 |
+
btn.click(get_summary, textbox, textbox)
|
15 |
+
|
16 |
+
demo.launch()
|