Skip to main content

evaluate/demo/serve

Evaluate

You can use classy evaluate to evaluate your trained model against a dataset. If no dataset is explicitly provided, classy will try to locate the test set provided to classy train (if any).

classy evaluate sequence-bert# accuracy: 0.9# classification metrics:... # f1: 0.9...

caution

If you move your model to a different pc, automatically inferring the location of the test set will fail unless it was also moved (and placed in a symmetric location in the file-system). Should it fail, providing the path explicitly should solve the issue.

Serve

info

You need to have installed classy with serve support. You can do this with pip install classy-core[serve]

You can use classy serve to expose your model via a REST API with FastAPI.

classy serve sequence-exampleREST API up and running at http://0.0.0.0:8000Checkout the OpenAPI docs at http://0.0.0.0:8000/docscurl -X 'POST' 'http://localhost:8000/' -H 'accept: application/json' -H 'Content-Type: application/json' -d '[{"sequence": "I wish I had never bought these terrible headphones!"}]'[{"sequence":"I wish I had never bought these terrible headphones!","label":"0"}]

You can also checkout the OpenAPI documentation page we automatically generate at http://0.0.0.0:8000/docs.

Classy Serve Docs

tip

By default, classy serve uses port 8000. Use the -p parameter to specify a different one.

Demo

info

You need to have installed classy with demo support. You can do this with pip install classy-core[demo]

You can use classy demo to spawn a Streamlit demo of your model.

classy demo sequence-exampleDemo up and running at http://0.0.0.0:8000

Now you can check out out the demo at http://0.0.0.0:8000!

Classy Demo - Model Classy Demo - Config