BART_Summerizer / app.py
Chillyblast's picture
Create app.py
2d8e2b5 verified
raw
history blame
570 Bytes
model_path = '/content/drive/My Drive/Bart_samsum'
from transformers import pipeline
# Load the tokenizer and model from the specified path
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
# Create a pipeline for text summarization
summarizer = pipeline("summarization", model=model, tokenizer=tokenizer)
# Example input for inference
# Perform inference
summary = summarizer(dialogue, max_length=500, min_length=300, do_sample=False)
# Print the summary
print("Summary:", summary[0]['summary_text'])