model/model.py. In this file, you write a Model class: an interface between the ML model that you’re packaging and the model server that you’re running it on.
The code to load and invoke a model in a Jupyter notebook or Python script maps directly to the code used in model/model.py.

model/model.py in your text editor.
Import transformers
Importtransformers.pipeline at the top of model/model.py:
- Code
- Diff
model/model.py
Load the model
TheModel.load() function runs exactly once when the model server is spun up or patched and loads the model onto the model server.
Update load() to bring in the text-classification model from transformers.pipeline:
- Code
- Diff
model/model.py
truss watch terminal tab.