Views
No views yet
1from transformers import T5Tokenizer, T5ForConditionalGeneration
2
3model_path = "KameronB/sitcc-t5-large-v3"
4
5# Load the model
6model = T5ForConditionalGeneration.from_pretrained(model_path, use_safetensors=True)
7
8# Load the tokenizer (if applicable)
9tokenizer = T5Tokenizer.from_pretrained(model_path)
10
11
12def summarize_ticket(ticket_text):
13 # Tokenize the input text
14 input_ids = tokenizer.encode("Summarize: " + ticket_text, return_tensors="pt")
15
16 # Generate the summary
17 summary_ids = model.generate(input_ids, min_length=10, max_length=100)
18
19 # Decode and return the summary
20 summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
21 return summary
22