Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,16 +7,20 @@ from transformers import pipeline
|
|
| 7 |
|
| 8 |
get_completion = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
|
| 9 |
|
| 10 |
-
|
|
|
|
| 11 |
output = get_completion(input)
|
| 12 |
return output[0]['summary_text']
|
| 13 |
|
| 14 |
gr.close_all()
|
| 15 |
demo = gr.Interface(fn=summarize,
|
| 16 |
inputs=[gr.Textbox(label="Text to summarize", lines=6)],
|
| 17 |
-
outputs=[gr.Textbox(label="
|
| 18 |
title="Text summarization with distilbart-cnn",
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
)
|
| 21 |
-
demo.launch(share=True)
|
| 22 |
-
|
|
|
|
| 7 |
|
| 8 |
get_completion = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
|
| 9 |
|
| 10 |
+
|
| 11 |
+
def summarize(input, max_length='5'):
|
| 12 |
output = get_completion(input)
|
| 13 |
return output[0]['summary_text']
|
| 14 |
|
| 15 |
gr.close_all()
|
| 16 |
demo = gr.Interface(fn=summarize,
|
| 17 |
inputs=[gr.Textbox(label="Text to summarize", lines=6)],
|
| 18 |
+
outputs=[gr.Textbox(label="Summary result", lines=3)],
|
| 19 |
title="Text summarization with distilbart-cnn",
|
| 20 |
+
#title="Text summarization of large data",
|
| 21 |
+
#description="Summarize any text using the `shleifer/distilbart-cnn-12-6` model under the hood!"
|
| 22 |
+
description="GV user interface to summarize large text. Summarization produces a shorter version of the document and text
|
| 23 |
+
while preserving the relevant and important information of the document."
|
| 24 |
)
|
| 25 |
+
#demo.launch(share=True, server_port=int(os.environ['PORT2']))
|
| 26 |
+
demo.launch(share=True)
|