Spaces:
Sleeping
Sleeping
Commit
·
c6c381f
1
Parent(s):
3d08384
Process output string
Browse files
app.py
CHANGED
@@ -2,12 +2,17 @@ from transformers import pipeline
|
|
2 |
import gradio as gr
|
3 |
|
4 |
model = pipeline("summarization", model="gsasikiran/bart-base-finetuned-cnn", tokenizer="facebook/bart-base")
|
5 |
-
title = "Article
|
6 |
-
description = "
|
7 |
-
article = "
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
hf = gr.Interface(
|
10 |
-
fn=
|
11 |
inputs=gr.Textbox(lines=5, label="Input Text"),
|
12 |
title=title,
|
13 |
description=description,
|
|
|
2 |
import gradio as gr
|
3 |
|
4 |
model = pipeline("summarization", model="gsasikiran/bart-base-finetuned-cnn", tokenizer="facebook/bart-base")
|
5 |
+
title = "Article summarizer"
|
6 |
+
description = "Generate summaries for articles based on the input text."
|
7 |
+
article = ""
|
8 |
+
|
9 |
+
def generate_summary(text):
|
10 |
+
summary_text = model(text)[0]['summary_text']
|
11 |
+
summary_text = summary_text.replace("\n", " ")
|
12 |
+
return
|
13 |
|
14 |
hf = gr.Interface(
|
15 |
+
fn=generate_summary,
|
16 |
inputs=gr.Textbox(lines=5, label="Input Text"),
|
17 |
title=title,
|
18 |
description=description,
|