File size: 1,020 Bytes
ff51eba
 
2d8e2b5
ff51eba
 
2d8e2b5
ff51eba
2d8e2b5
 
 
 
 
ff51eba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2d8e2b5
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# 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'])