Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
|
5 |
-
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
6 |
|
7 |
-
def
|
8 |
-
summary =
|
9 |
-
return summary[0]['
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
inputs=gr.Textbox(label="Enter Text", placeholder="Paste your long text here...", lines=10),
|
15 |
outputs=gr.Textbox(label="Summarized Text"),
|
16 |
title="Text Summarizer",
|
17 |
-
description="
|
18 |
)
|
19 |
|
20 |
-
|
21 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
sum = pipeline("summarization", model="facebook/bart-large-cnn")
|
|
|
5 |
|
6 |
+
def sumtext(text):
|
7 |
+
summary = sum(text, min_length=10, max_length=100, do_sample=False)
|
8 |
+
return summary[0]['summary']
|
9 |
|
10 |
+
gr = gr.Interface(
|
11 |
+
fn=sumtext,
|
12 |
+
inputs=gr.Textbox(label="Enter Text", lines=10),
|
|
|
13 |
outputs=gr.Textbox(label="Summarized Text"),
|
14 |
title="Text Summarizer",
|
15 |
+
description="Provide a lengthy text to receive a brief summary."
|
16 |
)
|
17 |
|
18 |
+
gr.launch()
|
|