Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Usage
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
```python
|
| 5 |
+
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 6 |
+
|
| 7 |
+
model_path = "KameronB/sitcc-t5-base-v3.0"
|
| 8 |
+
|
| 9 |
+
# Load the model
|
| 10 |
+
model = T5ForConditionalGeneration.from_pretrained(model_path, trust_remote_code=True, use_safetensors=True)
|
| 11 |
+
|
| 12 |
+
# Load the tokenizer (if applicable)
|
| 13 |
+
tokenizer = T5Tokenizer.from_pretrained(model_path)
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def summarize_ticket(ticket_text):
|
| 17 |
+
# Tokenize the input text
|
| 18 |
+
input_ids = tokenizer.encode("Summarize: " + ticket_text, return_tensors="pt")
|
| 19 |
+
|
| 20 |
+
# Generate the summary
|
| 21 |
+
summary_ids = model.generate(input_ids, min_length=10, max_length=100)
|
| 22 |
+
|
| 23 |
+
# Decode and return the summary
|
| 24 |
+
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
| 25 |
+
return summary
|
| 26 |
+
|
| 27 |
+
```
|