CoolFace
Apppublic

AKALYAS/RNN_Task

sourceHugging Faceupdated 1y agoView on Hugging Face
1likes
train.py16 linesDownload Raw Back to root
1from transformers import pipeline2 3# Load pretrained summarizer (T5-base under the hood)4summarizer = pipeline("summarization", model="t5-base", tokenizer="t5-base")5 6# Example text7text = """8Stocks rallied today after the central bank cut interest rates slightly.9Experts say the move was expected and could boost economic growth in the short term.10"""11 12# Summarize13summary = summarizer(text, max_length=30, min_length=5, do_sample=False)14 15print("Original:", text)16print("Summary:", summary[0]['summary_text'])