Pocket Text Lab

Abhishek Ghose

A text classifier that entirely runs locally on this page!

☰ Options

About Pocket Text Lab

The entire classification pipeline - training and inference - runs locally on this page using Pyodide and Transformers.js. Text is converted into vectors using an embedding model, a linear SVM is trained to classify, and finally, a Platt calibration step is applied, so that reliable probability scores are reported.

You can download this page and run it locally with a file URL on Firefox. For Chrome, you'd need to serve it locally to avoid security issues. Runs faster when WebGPU is supported; otherwise falls back to WASM. Intended as an experiment.

To save a runnable copy, use Download HTML from the Options menu, or Firefox’s Save Page As → Web Page, HTML only. Open the .html file in Firefox while connected to the internet. MHTML archives are not supported. The downloaded page includes the bundled demo when available; runtimes and model weights download as needed. Build the model again after opening the saved page.

- Abhishek Ghose

Build options

Choose stratified cross-validation folds and the fractions of data used for training, calibration, and testing. Fractions must add up to 1.

For 500 rows, the default fractions give 250 training, 100 calibration, and 150 test examples. Training and calibration counts round down; testing receives the remaining rows. Each training label needs at least one example per CV fold.

01 Train

Your dataset

One JSON object per line: {"text":"A wonderful film","label":"positive"}. At least two classes, with 10 or more examples per class.

500 demo examples·
Ready. Edit the demo or paste your own labeled examples.
Data & training statistics

Loading 500 SST-5 movie-review sentences, 100 per sentiment class.

Dataset
SST-5 · Stanford Sentiment Treebank
Embedding model
Snowflake/snowflake-arctic-embed-m-v1.5 (frozen, FP16)
Embedding backend
Automatic · WebGPU preferred
Classifier
scikit-learn LinearSVC
Calibration
Sigmoid (Platt scaling) on split_b
Selection metric
3-fold CV macro F1; C ∈ {0.01, 0.1, 1, 10, 100}
Test macro F1—
Best C—
split_a / b / c rows—

Build the model to see training and test results.

02 Input text to classify

Input text

Build a model first

One snippet per line. Predictions update automatically. Every build fills five examples from the test split (or all examples if fewer than five are available).

Available after training completes.
03 Predict

Predictions

Waiting
Your predictions will appear here, in input order.