Pocket Text Lab

Abhishek Ghose

A text classifier that entirely runs locally on this page! Best viewed on a large screen.

☰ Options

About Pocket Text Lab

The entire classification pipeline - training and inference - runs locally in your browser (no server) using Pyodide and Transformers.js. The visualization uses umap-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. The visualization button activates only after a model is built; its interactive and you should definitely check it out!

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

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. To build a new model refresh the page.

Intended as an experiment.

- 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

Desktop recommended. Please use a desktop or laptop for this page. Model building uses substantial memory and may cause mobile browsers to reload the page.

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.