Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,32 +1,20 @@
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import torch
|
|
|
|
| 3 |
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
#translator = pipeline(task="translation",
|
| 6 |
-
# model="./models/facebook/nllb-200-distilled-600M",
|
| 7 |
-
# torch_dtype=torch.bfloat16) #
|
| 8 |
-
|
| 9 |
-
#text = """\
|
| 10 |
-
#My puppy is adorable, \
|
| 11 |
-
#Your kitten is cute.
|
| 12 |
-
#Her panda is friendly.
|
| 13 |
-
#His llama is thoughtful. \
|
| 14 |
-
#We all have nice pets!"""
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
#text_translated = translator(text,
|
| 18 |
-
# src_lang="eng_Latn",
|
| 19 |
-
# tgt_lang="fra_Latn")#
|
| 20 |
-
#
|
| 21 |
-
#text_translated
|
| 22 |
|
| 23 |
-
import gradio as gr
|
| 24 |
|
| 25 |
# name of the function
|
| 26 |
-
def
|
| 27 |
-
return
|
|
|
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
-
demo = gr.Interface(fn=
|
| 31 |
|
| 32 |
demo.launch()
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import torch
|
| 3 |
+
import gradio as gr
|
| 4 |
|
| 5 |
+
summarizer = pipeline(task="summarization",
|
| 6 |
+
model="./models/facebook/bart-large-cnn",
|
| 7 |
+
torch_dtype=torch.bfloat16)
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
|
|
|
| 10 |
|
| 11 |
# name of the function
|
| 12 |
+
def summary(text):
|
| 13 |
+
return summary = summarizer(text,
|
| 14 |
+
min_length=10,
|
| 15 |
+
max_length=100)
|
| 16 |
|
| 17 |
|
| 18 |
+
demo = gr.Interface(fn=summary, inputs="text", outputs="text")
|
| 19 |
|
| 20 |
demo.launch()
|