In this example, we build a Truss with a model that requires specific system packages.
To add system packages to your Truss, you can add a system_packages key to your config.yaml file,
for instance:
To add system packages to your model serving environment, open config.yaml and
update the system_packages key with a list of apt-installable Debian packages:
config.yaml
Copy
Ask AI
system_packages: - tesseract-ocr
For this example, we use the LayoutLM Document QA model,
a multimodal model that answers questions about provided invoice documents. This model requires a system
package, tesseract-ocr, which needs to be included in the model serving environment.
The main items that need to be configured in the config.yaml file are requirements
and system_packages sections.
config.yaml
Copy
Ask AI
environment_variables: {}external_package_dirs: []model_metadata: example_model_input: {"url": "https://templates.invoicehome.com/invoice-template-us-neat-750px.png", "prompt": "What is the invoice number?"}model_name: LayoutLM Document QApython_version: py39
Specify the versions of the Python requirements that are needed.
Always pin exact versions for your Python dependencies. The ML/AI space moves fast, so you want to have an up-to-date version of each package while also being protected from breaking changes.