Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
from transformers import pipeline
|
| 4 |
+
|
| 5 |
+
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
| 6 |
+
|
| 7 |
+
def f(x):
|
| 8 |
+
return summarizer(x, max_length=160, min_length=40, do_sample=False)[0]['summary_text']
|
| 9 |
+
|
| 10 |
+
iface = gr.Interface(fn=f, inputs="text", outputs="text")
|
| 11 |
+
iface.launch(share=True)
|