Spaces:
Sleeping
Sleeping
Ifeanyi
commited on
Commit
·
3dc74fc
1
Parent(s):
d6c295a
App files
Browse files- app.py +16 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
def textSummarizer(ARTICLE,OutputLength):
|
| 5 |
+
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
| 6 |
+
result = summarizer(ARTICLE, max_length=244, min_length=OutputLength, do_sample=False)
|
| 7 |
+
return result[0]["summary_text"]
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
app = gr.Interface(textSummarizer,
|
| 11 |
+
inputs = [gr.Textbox(),gr.Slider(minimum=0,maximum=50,step=1)],
|
| 12 |
+
outputs = gr.Textbox(),
|
| 13 |
+
title = "Article Summarizer",
|
| 14 |
+
theme=gr.themes.Soft())
|
| 15 |
+
|
| 16 |
+
app.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers
|
| 2 |
+
gradio
|