generated from posit-conf-2023/workshop-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add docker slides * bare bones docker slides * move content to deploy slides * add classwork shell * look at model before prepare_docker * clean up names
- Loading branch information
1 parent
1b56040
commit e301ecf
Showing
2 changed files
with
157 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
format: html | ||
title: Deploying a model with Docker | ||
--- | ||
|
||
## Choose a pinned model to deploy | ||
|
||
```{python} | ||
#| eval: false | ||
import pins | ||
import os | ||
from dotenv import load_dotenv | ||
from vetiver import VetiverModel | ||
load_dotenv() | ||
api_key = os.getenv("CO_API_KEY") | ||
rsc_url = os.getenv("CO_RSC_URL") | ||
board = board_connect(server_url=rsc_url, api_key=api_key, allow_pickle_read = True) | ||
VetiverModel.from_pin( | ||
board, | ||
"isabel.zimmerman/inspection-python", | ||
version = "20220901T144702Z-fd402" | ||
).description | ||
``` | ||
|
||
## Create artifacts to run a Dockerfile | ||
|
||
```{python} | ||
#| eval: false | ||
import vetiver | ||
vetiver.prepare_docker( | ||
board = ___, | ||
pin_name = ___, | ||
version = ___, | ||
host = ___, | ||
port = ___ | ||
) | ||
``` | ||
|
||
What outputs are created? | ||
|
||
## Build your container | ||
|
||
```bash | ||
docker build -t inpection . | ||
``` | ||
|
||
## Run your container | ||
|
||
```bash | ||
docker run --env-file .env -p 8080:8080 inpection | ||
``` | ||
|
||
## Make predictions | ||
|
||
```{python} | ||
#| eval: false | ||
endpoint = vetiver.vetiver_endpoint(url = ___) | ||
vetiver.predict(endpoint = ___, data = ___) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters