pdf-summarizer-app / textsumm.py
3a05chatgpt's picture
Upload 8 files
f1e5728 verified
raw
history blame
424 Bytes
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