Yes; Cortex makes all files in the project directory (i.e. the directory which contains
cortex.yaml) available to pre and post inference handlers. There are a few file types that are excluded from this: any files and folders that start with
., Python generated files, and
cortex.yaml are not passed through.
The contents of the project directory are available in
/mnt/project/ in the API containers. For example, if this is your project directory:
./iris-classifier/ ├── cortex.yaml ├── config.json ├── handler.py ├── ... └── requirements.txt
You can access
handler.py like this:
import json with open('/mnt/project/config.json', 'r') as config_file: config = json.load(config_file) def pre_inference(sample, metadata): print(config) ...