You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/deployments/request-handlers.md
+45-3Lines changed: 45 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,8 +78,50 @@ boto3==1.9.228
78
78
msgpack==0.6.1
79
79
numpy==1.17.2
80
80
requests==2.22.0
81
-
tensorflow==1.14.0 # In TensorFlow serving images only
82
-
onnxruntime==0.5.0 # In ONNX serving images only
81
+
tensorflow==1.14.0 # For TensorFlow models only
82
+
onnxruntime==0.5.0 # For ONNX models only
83
83
```
84
84
85
-
You can install additional PyPI packages and import your own Python packages. See [Python Packages](../piplines/python-packages.md) for more details.
85
+
## PyPI packages
86
+
87
+
You can install additional PyPI packages and import them your handlers. Cortex looks for a `requirements.txt` file in the top level Cortex project directory (i.e. the directory which contains `cortex.yaml`):
88
+
89
+
```text
90
+
./iris-classifier/
91
+
├── cortex.yaml
92
+
├── handler.py
93
+
├── ...
94
+
└── requirements.txt
95
+
```
96
+
97
+
## Project files
98
+
99
+
Cortex makes all files in the project directory (i.e. the directory which contains `cortex.yaml`) available to pre and post inference handlers. Python generated files and files and folders that start with `.` are excluded.
100
+
101
+
The contents of the project directory is available in `/mnt/project/` in the API containers. For example, if this is your project directory:
102
+
103
+
```text
104
+
./iris-classifier/
105
+
├── cortex.yaml
106
+
├── config.json
107
+
├── handler.py
108
+
├── ...
109
+
└── requirements.txt
110
+
```
111
+
112
+
You can access `config.json` in `handler.py` like this:
113
+
114
+
```python
115
+
import json
116
+
117
+
withopen('/mnt/project/config.json', 'r') as config_file:
118
+
config = json.load(config_file)
119
+
120
+
defpre_inference(sample, metadata):
121
+
print(config)
122
+
...
123
+
```
124
+
125
+
## System packages
126
+
127
+
You can also install additional system packages. See [System Packages](system-packages.md) for more details.
0 commit comments