1from transformers import pipeline
2
3classifier = pipeline(
4 "text-classification",
5 model="sureshbabugandla/ML_OPS_ASSIGNMENT2"
6)
7
8result = classifier("This book was a thrilling mystery with unexpected twists.")
9print(result)
1from transformers import DistilBertTokenizerFast, DistilBertForSequenceClassification
2
3tokenizer = DistilBertTokenizerFast.from_pretrained("sureshbabugandla/ML_OPS_ASSIGNMENT2")
4model = DistilBertForSequenceClassification.from_pretrained("sureshbabugandla/ML_OPS_ASSIGNMENT2")
The model was trained on the
UCSD Book Graph dataset, which contains book reviews from Goodreads across multiple genres. 2,000 reviews were sampled from each of the 8 genres, split into 800 train and 200 test samples per genre.