Spaces:
Runtime error
Runtime error
# Load model directly | |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM | |
tokenizer = AutoTokenizer.from_pretrained("Chillyblast/Bart_Summarization") | |
model = AutoModelForSeq2SeqLM.from_pretrained("Chillyblast/Bart_Summarization") | |
from transformers import pipeline | |
# Create a pipeline for text summarization | |
summarizer = pipeline("summarization", model=model, tokenizer=tokenizer) | |
# Example input for inference | |
dialogue= | |
''' | |
Hannah: Hey, do you have Betty's number? | |
Amanda: Lemme check | |
Hannah: <file_gif> | |
Amanda: Sorry, can't find it. | |
Amanda: Ask Larry | |
Amanda: He called her last time we were at the park together | |
Hannah: I don't know him well | |
Hannah: <file_gif> | |
Amanda: Don't be shy, he's very nice | |
Hannah: If you say so.. | |
Hannah: I'd rather you texted him | |
Amanda: Just text him π | |
Hannah: Urgh.. Alright | |
Hannah: Bye | |
Amanda: Bye bye | |
''' | |
# Perform inference | |
summary = summarizer(dialogue, max_length=500, min_length=300, do_sample=False) | |
# Print the summary | |
print("Summary:", summary[0]['summary_text']) | |