Meatgrinder/summarize.py
2024-10-10 11:03:15 -04:00

13 lines
314 B
Python

from transformers import pipeline
def process(input_text):
summarizer = pipeline(
"summarization",
model="marianna13/flan-t5-base-summarization",
max_length=200,
min_length=10,
device="mps"
)
output = summarizer(input_text)[0]['summary_text']
return output