Spaces:
Sleeping
Sleeping
trituenhantaoio
commited on
Commit
•
e23ecbc
0
Parent(s):
Duplicate from trituenhantaoio/ViNewsSum
Browse files- .gitattributes +27 -0
- README.md +14 -0
- app.py +40 -0
- requirements.txt +4 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
19 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: ViNewsSum
|
3 |
+
emoji: 🐨
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: purple
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.0.12
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: cc-by-4.0
|
11 |
+
duplicated_from: trituenhantaoio/ViNewsSum
|
12 |
+
---
|
13 |
+
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces#reference
|
app.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from gradio.mix import Parallel, Series
|
3 |
+
|
4 |
+
from transformers import pipeline
|
5 |
+
|
6 |
+
summarizer = pipeline("summarization", model="VietAI/vit5-large-vietnews-summarization")
|
7 |
+
|
8 |
+
|
9 |
+
def summarize(inp):
|
10 |
+
text = "vietnews: " + inp + " </s>"
|
11 |
+
res = summarizer(
|
12 |
+
text,
|
13 |
+
max_length=256,
|
14 |
+
early_stopping=True,
|
15 |
+
)[0]['summary_text']
|
16 |
+
return res
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
sample_url = [['VietAI là tổ chức phi lợi nhuận với sứ mệnh ươm mầm tài năng về trí tuệ nhân tạo và xây dựng một cộng đồng các chuyên gia trong lĩnh vực trí tuệ nhân tạo đẳng cấp quốc tế tại Việt Nam.'],
|
21 |
+
]
|
22 |
+
|
23 |
+
article = "<p style='text-align: center'><a href='https://vietai.org' target='_blank'>by VietAI Research</a> | <a href='https://github.com/vietai/ViT5' target='_blank'>Github</a> | Contact: <a href='mailto:[email protected]' target='_blank'>Hieu Tran</a></p></center></p>"
|
24 |
+
|
25 |
+
|
26 |
+
iface = gr.Interface(fn=summarize,
|
27 |
+
inputs = gr.inputs.Textbox(
|
28 |
+
lines = 5,
|
29 |
+
label = 'Enter an article...'
|
30 |
+
),
|
31 |
+
outputs = 'text',
|
32 |
+
title = 'Vi(etnamese)T5 Abstractive Summarization',
|
33 |
+
theme = 'grass',
|
34 |
+
layout = 'horizontal',
|
35 |
+
article=article,
|
36 |
+
examples=sample_url)
|
37 |
+
|
38 |
+
iface.launch()
|
39 |
+
|
40 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
sentencepiece
|
3 |
+
tokenizers
|
4 |
+
torch
|