Skip to content

Commit 9eb7c92

Browse files
authored
Improve getting started section (#2)
1 parent f29f615 commit 9eb7c92

File tree

2 files changed

+56
-4
lines changed

2 files changed

+56
-4
lines changed

README.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,64 @@ pip install git+https://github.com/cortexlabs/nucleus.git@master
4444

4545
```bash
4646
$ nucleus generate --help
47-
Usage: nucleus generate [OPTIONS] CONFIG
47+
Usage: nucleus [OPTIONS] COMMAND [ARGS]...
4848

49-
A Cortex utility to generate Dockerfile Nucleus model servers
49+
Use the Nucleus CLI to generate model servers for Python-generic and
50+
TensorFlow models. Compatible with Cortex clusters.
5051

5152
Options:
5253
--help Show this message and exit.
54+
55+
Commands:
56+
generate A utility to generate Dockerfile(s) for Nucleus model servers.
57+
version Get Nucleus CLI version.
58+
```
59+
60+
## Example
61+
62+
Generate model server Dockerfile
63+
64+
```bash
65+
$ nucleus generate examples/rest-python-iris-classifier/model-server-config.yaml
66+
-------------- nucleus model server config --------------
67+
type: python
68+
py_version: 3.6.9
69+
path: handler.py
70+
multi_model_reloading:
71+
path: s3://cortex-examples/sklearn/iris-classifier/
72+
use_local_cortex_libs: false
73+
serve_port: 8080
74+
processes: 1
75+
threads_per_process: 1
76+
max_concurrency: 0
77+
dependencies:
78+
pip: requirements.txt
79+
conda: conda-packages.txt
80+
shell: dependencies.sh
81+
gpu_version: null
82+
gpu: false
83+
84+
---------------------------------------------------------
85+
generating nucleus.Dockerfile dockerfile ...
86+
```
87+
88+
Build the aforementioned Docker image
89+
90+
```bash
91+
$ docker build -f nucleus.Dockerfile -t nucleus .
92+
```
93+
94+
Run the Nucleus model server
95+
96+
```bash
97+
$ docker run -it --rm -p 8080:8080 nucleus
98+
```
99+
100+
Finally, make a request to it
101+
102+
```bash
103+
$ curl localhost:8080/ -X POST -H "Content-type: application/json" -d @examples/rest-python-iris-classifier/sample.json
104+
{"prediction": "setosa", "model": {"version": "latest"}}
53105
```
54106

55107
# Configuration

nucleus/generate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def build_handler_dockerfile(config: dict, path_to_config: str, dev_env: bool) -
225225
]
226226
else:
227227
handler_lines += [
228-
"RUN git clone --depth 1 -b v${CORTEX_MODEL_SERVER_VERSION} https://github.com/cortexlabs/nucleus && \\",
228+
"RUN git clone --depth 1 -b ${CORTEX_MODEL_SERVER_VERSION} https://github.com/cortexlabs/nucleus && \\",
229229
" cp -r nucleus/src/ /src/ && \\",
230230
" rm -r nucleus/",
231231
"",
@@ -363,7 +363,7 @@ def build_tensorflow_dockerfile(config: dict, tfs_dockerfile: bytes, dev_env: bo
363363
]
364364
else:
365365
tfs_lines += [
366-
"RUN git clone --depth 1 -b v${CORTEX_MODEL_SERVER_VERSION} https://github.com/cortexlabs/nucleus \\",
366+
"RUN git clone --depth 1 -b ${CORTEX_MODEL_SERVER_VERSION} https://github.com/cortexlabs/nucleus \\",
367367
" cp nucleus/nucleus/templates/tfs-run.sh /src/ && \\",
368368
" rm -r nucleus/",
369369
]

0 commit comments

Comments
 (0)