Spaces:
Sleeping
Sleeping
File size: 424 Bytes
93c008b f1e5728 93c008b f1e5728 |
1 2 3 4 5 6 7 8 9 10 11 12 |
from transformers import pipeline
# 建立中文摘要管道
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
def 文字摘要(輸入文本, max_length=130, min_length=30, do_sample=False):
"""
將輸入的純文字自動摘要為繁體中文重點
"""
result = summarizer(輸入文本, max_length=max_length, min_length=min_length, do_sample=do_sample)
return result
|