CoolFace
Modelpublic

leoole/spoiler-detector

sourceHugging Facemitupdated 5mo agoView on Hugging Face
0likes
Model Card

Multi-Source Spoiler Detector

This repository contains the trained classifier for a three-level movie-review spoiler detector.

Task

The model predicts one of three labels:

  • —Safe: no meaningful spoiler detected
  • —Mild: broad setup, tone, or non-critical plot information
  • —Major: key twist, death, identity, ending, solution, or final outcome revealed

Model

  • —Classifier: SVM with RBF kernel (sklearn.svm.SVC)
  • —Embeddings: sentence-transformers/all-mpnet-base-v2
  • —Input: English movie-review text
  • —Output: Major, Mild, or Safe

The serialized model is stored in best_model.joblib. It contains both the trained classifier and metadata with the embedding model name and label classes.

Test Results

ModelAccuracyMacro F1Weighted F1
SVM RBF0.57530.57230.5752
Logistic Regression0.56690.57060.5661
MLP0.56900.56400.5670
Random Forest0.53140.41660.4434

Best test model: SVM RBF.

Usage

python
import joblib
from sentence_transformers import SentenceTransformer

payload = joblib.load("best_model.joblib")
model = payload["model"]
metadata = payload["metadata"]
classes = metadata["label_classes"]

embedder = SentenceTransformer(metadata["embedding_model"])
text = "The final scene reveals that the detective was the killer all along."
X = embedder.encode([text], convert_to_numpy=True, normalize_embeddings=True)
label_id = int(model.predict(X)[0])
print(classes[label_id])

Data

The training data was built from IMDb reviews and GPT-generated synthetic review snippets. GPT was also used to assign Mild/Major severity labels for IMDb spoiler reviews. A manual quality check of 100 sampled Mild/Major labels found 93% exact agreement.

Limitations

Spoiler severity is subjective, especially between Mild and Major. Synthetic examples can also differ stylistically from real user reviews, so results should be interpreted as a course-project prototype rather than a production moderation system.