Spaces:
Paused
Paused
tomato
commited on
Commit
·
9e5c5bb
1
Parent(s):
ebc4448
it's first commit, for testing model [IDEA-CCNL/Randeng-Pegasus-238M-Summary-Chinese]
Browse files- .gitignore +0 -0
- app.py +36 -0
- requirements.txt +4 -0
.gitignore
ADDED
File without changes
|
app.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import torch
|
3 |
+
from tqdm import tqdm
|
4 |
+
from transformers import pipeline
|
5 |
+
|
6 |
+
MODEL_NAME = "IDEA-CCNL/Randeng-Pegasus-238M-Summary-Chinese"
|
7 |
+
|
8 |
+
summarizer = pipeline(
|
9 |
+
task="automatic-speech-recognition",
|
10 |
+
model=MODEL_NAME
|
11 |
+
)
|
12 |
+
|
13 |
+
|
14 |
+
def summarize(text):
|
15 |
+
return summarizer(text)
|
16 |
+
|
17 |
+
|
18 |
+
demo = gr.Blocks(title="⭐ Summ4rizer ⭐")
|
19 |
+
demo.encrypt = False
|
20 |
+
|
21 |
+
with demo:
|
22 |
+
gr.Markdown(f'''
|
23 |
+
<div>
|
24 |
+
<h1 style='text-align: center'>Text Summarizer</h1>
|
25 |
+
</div>
|
26 |
+
<div>
|
27 |
+
Using summarization Model from <a href='https://huggingface.co/{MODEL_NAME}' target='_blank'><b>{MODEL_NAME}</b></a>.
|
28 |
+
</div>
|
29 |
+
''')
|
30 |
+
text = gr.Textbox(label="Text here !!", lines=1, interactive=True)
|
31 |
+
summarize_btn = gr.Button("Let's Summarize",)
|
32 |
+
summarization = gr.Textbox()
|
33 |
+
html_output = gr.Markdown()
|
34 |
+
summarize_btn.click(summarize, [text], outputs=[html_output, summarization])
|
35 |
+
|
36 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
torch
|
3 |
+
tqdm
|
4 |
+
transformers
|