Spaces:
Sleeping
Sleeping
Update app.py
Browse filesInitial deployment
app.py
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
)
|
| 6 |
|
| 7 |
demo.launch()
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
summarizer = pipeline(
|
| 5 |
+
"summarization",
|
| 6 |
+
model="facebook/bart-large-cnn"
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
demo = gr.Interface(
|
| 10 |
+
fn=lambda text: summarizer(text)[0]["summary_text"],
|
| 11 |
+
inputs=gr.Textbox(
|
| 12 |
+
lines=10,
|
| 13 |
+
label="Enter Text"
|
| 14 |
+
),
|
| 15 |
+
outputs=gr.Textbox(
|
| 16 |
+
label="Summary"
|
| 17 |
+
),
|
| 18 |
+
title="Text Summarizer Demo"
|
| 19 |
)
|
| 20 |
|
| 21 |
demo.launch()
|