Spaces:
Sleeping
Sleeping
Commit
·
775ea34
1
Parent(s):
2cce74e
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,18 @@
|
|
| 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 |
-
|
|
|
|
|
|
|
| 9 |
|
| 10 |
demo = gr.Interface(fn=summarize, inputs="text", outputs="text")
|
| 11 |
demo.launch()
|
| 12 |
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
#get_completion = pipeline("summarization", model="shleifer/distilbart-cnn-12-6")
|
| 5 |
+
summarizer = pipeline("summarization", model="Falconsai/text_summarization")
|
| 6 |
+
|
| 7 |
+
print(summarizer(ARTICLE, max_length=230, min_length=30, do_sample=False))
|
| 8 |
|
| 9 |
def summarize(input):
|
| 10 |
+
#output = get_completion(input)
|
| 11 |
+
output = summarizer(ARTICLE, max_length=230, min_length=30, do_sample=False))
|
| 12 |
+
#return output[0]['summary_text']
|
| 13 |
+
return output
|
| 14 |
|
| 15 |
demo = gr.Interface(fn=summarize, inputs="text", outputs="text")
|
| 16 |
demo.launch()
|
| 17 |
|
| 18 |
+
|