Skip to main content

Using your trained model

Now that we have our trained model called fast-ner, stored under experiments/fast-ner/<date>/<time>, we can use it!

classy offers a wide variety of commands to explore, test and deploy your trained models.

Predicting

Use fast-ner to perform Named Entity Recognition on every sentence stored in a target file:

info

Recall that classy predict has two modes: interactive, which lets you query the model from the shell, and file, which instead reads the dataset items from the specified file.

cat target.tsv | head -1Google 's headquarters are in California .classy predict file fast-ner target.tsv -o target.out.tsvPrediction completecat target.out.tsv | head -1Google 's headquarters are in California . <tab> ORG O O O O LOC O

classy predict also supports an interactive mode. Check out the documentation for more details.

Presenting

Present a demo of fast-ner:

classy demo fast-nerDemo up and running at http://0.0.0.0:8000

The demo (available at http://localhost:8000/) has a page to try free-hand input texts or samples taken from a validation or test set, if available, and a page that shows the full configuration the model has been trained with. For more details, check out classy demo's documentation.

Classy Demo

Exposing via REST API

Expose fast-ner via a REST API that can be queried by any REST client:

classy serve fast-nerREST API up and running at http://0.0.0.0:8000Checkout the OpenAPI docs at http://localhost:8000/docscurl -X 'POST' 'http://localhost:8000/' -H 'accept: application/json' -H 'Content-Type: application/json' -d '[{"tokens": ["Google", "'\''s", "headquarters", "are", "in", "California", "."]}]'[{"tokens": ["Google", "'s", "headquarters", "are", "in", "California", "."], "labels": ["ORG", "O", "O", "O", "O", "LOC", "O"]}]

We also automatically generate the OpenAPI documentation page!

Classy Serve Docs