Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,17 @@
|
|
1 |
-
#Code adapted from: https://huggingface.co/spaces/
|
2 |
|
3 |
import gradio as gr
|
4 |
-
|
5 |
-
#import transformers
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#Code adapted from: https://huggingface.co/spaces/mca183/text-summarization-distilbart-cnn/blob/main/app.py
|
2 |
|
3 |
import gradio as gr
|
4 |
+
from transformers import pipeline
|
|
|
5 |
|
6 |
+
get_completion = pipeline("summarization", model="PhLoDuTi/tns_ft5tech")
|
7 |
+
|
8 |
+
def summarize(input):
|
9 |
+
output = get_completion(input)
|
10 |
+
return output[0]['summary_text']
|
11 |
+
|
12 |
+
demo = gr.Interface(fn=summarize,
|
13 |
+
inputs=[gr.Textbox(label="Text to summarize", lines=6)],
|
14 |
+
outputs=[gr.Textbox(label="Result", lines=3)],
|
15 |
+
title="Text summarization",
|
16 |
+
description="Put in any tech news article here.")
|
17 |
+
demo.launch(share=True)
|