Skip to content

Commit 026abbd

Browse files
committed
Update example README files
1 parent 10a9a4b commit 026abbd

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

examples/image-classifier/README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ A `deployment` specifies a set of resources that are deployed as a single unit.
88

99
```yaml
1010
- kind: deployment
11-
name: image-classifier
11+
name: image
1212

1313
- kind: api
14-
name: alexnet
14+
name: classifier
1515
model: s3://cortex-examples/image-classifier/alexnet.onnx
1616
request_handler: alexnet_handler.py
17+
tracker:
18+
model_type: classification
1719
```
20+
1821
<!-- CORTEX_VERSION_MINOR x2 -->
1922
You can run the code that generated the exported models used in this example folder here:
2023
- [Pytorch Alexnet](https://colab.research.google.com/github/cortexlabs/cortex/blob/master/examples/image-classifier/alexnet.ipynb)
@@ -76,7 +79,7 @@ Behind the scenes, Cortex containerizes the models, makes them servable using ON
7679
You can track the statuses of the APIs using `cortex get`:
7780

7881
```bash
79-
$ cortex get alexnet --watch
82+
$ cortex get classifier --watch
8083
8184
status up-to-date available requested last update avg latency
8285
live 1 1 1 12s -
@@ -87,11 +90,11 @@ The output above indicates that one replica of the API was requested and one rep
8790
## Serve real-time predictions
8891

8992
```bash
90-
$ cortex get alexnet
93+
$ cortex get classifier
9194
92-
url: http://***.amazonaws.com/image-classifier/alexnet
95+
url: http://***.amazonaws.com/image/classifier
9396
94-
$ curl http://***.amazonaws.com/image-classifier/alexnet \
97+
$ curl http://***.amazonaws.com/image/classifier \
9598
-X POST -H "Content-Type: application/json" \
9699
-d '{"url": "https://bowwowinsurance.com.au/wp-content/uploads/2018/10/akita-700x700.jpg"}'
97100

examples/iris-classifier/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ Define a `deployment` and an `api` resource in `cortex.yaml`. A `deployment` spe
1414
name: classifier
1515
model: s3://cortex-examples/iris-classifier/tensorflow
1616
request_handler: handlers/tensorflow.py
17+
tracker:
18+
model_type: classification
1719
```
20+
1821
<!-- CORTEX_VERSION_MINOR x5 -->
1922
You can run the code that generated the exported models used in this folder example here:
2023
- [Tensorflow](https://colab.research.google.com/github/cortexlabs/cortex/blob/master/examples/iris-classifier/models/tensorflow.ipynb)

examples/sentiment-analysis/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This example shows how to deploy a sentiment analysis classifier trained using [
44

55
## Define a deployment
66

7-
A `deployment` specifies a set of resources that are deployed as a single unit. An `api` makes a model available as a web service that can serve real-time predictions. This configuration will download the model from the `cortex-examples` S3 bucket and preprocess the payload and postprocess the inference with functions defined in `sentiment.py`.
7+
A `deployment` specifies a set of resources that are deployed as a single unit. An `api` makes a model available as a web service that can serve real-time predictions. This configuration will download the model from the `cortex-examples` S3 bucket and preprocess the payload and postprocess the inference with functions defined in `handler.py`.
88

99
```yaml
1010
- kind: deployment
@@ -13,8 +13,11 @@ A `deployment` specifies a set of resources that are deployed as a single unit.
1313
- kind: api
1414
name: classifier
1515
model: s3://cortex-examples/sentiment-analysis/bert
16-
request_handler: sentiment.py
16+
request_handler: handler.py
17+
tracker:
18+
model_type: classification
1719
```
20+
1821
<!-- CORTEX_VERSION_MINOR -->
1922
You can run the code that generated the exported BERT model [here](https://colab.research.google.com/github/cortexlabs/cortex/blob/master/examples/sentiment-analysis/bert.ipynb).
2023
@@ -74,11 +77,11 @@ The output above indicates that one replica of the API was requested and one rep
7477
## Serve real-time predictions
7578

7679
```bash
77-
$ cortex get analysis
80+
$ cortex get classifier
7881
79-
url: http://***.amazonaws.com/sentiment/analysis
82+
url: http://***.amazonaws.com/sentiment/classifier
8083
81-
$ curl http://***.amazonaws.com/sentiment/analysis \
84+
$ curl http://***.amazonaws.com/sentiment/classifier \
8285
-X POST -H "Content-Type: application/json" \
8386
-d '{"review": "The movie was great!"}'
8487

examples/text-generator/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This example shows how to deploy OpenAI's GPT-2 model as a service on AWS.
44

55
## Define a deployment
66

7-
A `deployment` specifies a set of resources that are deployed as a single unit. An `api` makes a model available as a web service that can serve real-time predictions. This configuration will download the 124M GPT-2 model from the `cortex-examples` S3 bucket, preprocess the payload and postprocess the inference with functions defined in `encoder.py` and deploy each replica of the API on 1 GPU.
7+
A `deployment` specifies a set of resources that are deployed as a single unit. An `api` makes a model available as a web service that can serve real-time predictions. This configuration will download the 124M GPT-2 model from the `cortex-examples` S3 bucket, preprocess the payload and postprocess the inference with functions defined in `handler.py` and deploy each replica of the API on 1 GPU.
88

99
```yaml
1010
- kind: deployment
@@ -13,16 +13,18 @@ A `deployment` specifies a set of resources that are deployed as a single unit.
1313
- kind: api
1414
name: generator
1515
model: s3://cortex-examples/text-generator/gpt-2/124M
16-
request_handler: encoder.py
16+
request_handler: handler.py
1717
compute:
18+
cpu: 1
1819
gpu: 1
1920
```
21+
2022
<!-- CORTEX_VERSION_MINOR -->
2123
You can run the code that generated the exported GPT-2 model [here](https://colab.research.google.com/github/cortexlabs/cortex/blob/master/examples/text-generator/gpt-2.ipynb).
2224
2325
## Add request handling
2426
25-
The model requires encoded data for inference, but the API should accept strings of natural language as input. It should also decode the model’s prediction before responding to the client. This can be implemented in a request handler file using the pre_inference and post_inference functions. See [encoder.py](encoder.py) for the complete code.
27+
The model requires encoded data for inference, but the API should accept strings of natural language as input. It should also decode the model’s prediction before responding to the client. This can be implemented in a request handler file using the pre_inference and post_inference functions.
2628
2729
```python
2830
from encoder import get_encoder
@@ -66,6 +68,10 @@ The output above indicates that one replica of the API was requested and one rep
6668
## Serve real-time predictions
6769

6870
```bash
71+
$ cortex get generator
72+
73+
url: http://***.amazonaws.com/text/generator
74+
6975
$ curl http://***.amazonaws.com/text/generator \
7076
-X POST -H "Content-Type: application/json" \
7177
-d '{"text": "machine learning"}'

0 commit comments

Comments
 (0)