Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
get_completion = pipeline("summarization", model="shleifer/distilbart-cnn-12-6")
|
| 5 |
+
|
| 6 |
+
def summarize(input):
|
| 7 |
+
output = get_completion(input)
|
| 8 |
+
return output[0]['summary_text']
|
| 9 |
+
|
| 10 |
+
gr.close_all()
|
| 11 |
+
demo = gr.Interface(fn=summarize, inputs="text", outputs="text")
|
| 12 |
+
demo.launch()
|