Text_Summarize / summarizer.py
dschandra's picture
Create summarizer.py
7fc4ba1 verified
raw
history blame contribute delete
346 Bytes
from model import load_model
# Initialize the model
model = load_model()
def summarize_text(input_text: str) -> str:
"""
Summarize the input text using the pre-trained Hugging Face model.
"""
# Get the summary
summary = model(input_text, max_length=200, min_length=50, do_sample=False)
return summary[0]['summary_text']