Spaces:
Runtime error
Runtime error
git.name
commited on
Commit
•
86c8e57
1
Parent(s):
4bf82dc
initial commit
Browse files- app.py +19 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
task = 'summarization'
|
5 |
+
model = 'sshleifer/distilbart-cnn-12-6'
|
6 |
+
|
7 |
+
get_completion = pipeline(task=task, model=model)
|
8 |
+
|
9 |
+
def summarize(input):
|
10 |
+
output = get_completion(input)
|
11 |
+
return output[0]['summary_text']
|
12 |
+
|
13 |
+
result = gr.Interface(fn=summarize,
|
14 |
+
inputs=[gr.TextArea(label='Text to summerize:')],
|
15 |
+
outputs=gr.TextArea(label='Summary'),
|
16 |
+
title='Text summerization with distilbart-cnn',
|
17 |
+
description="Summerize any text using `sshleifer/distilbart-cnn-12-6` model under the hood!"
|
18 |
+
)
|
19 |
+
result.launch(inline=False)
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
torch
|
2 |
+
transformers
|