Skip to content

Commit

Permalink
pack and share demo script
Browse files Browse the repository at this point in the history
  • Loading branch information
gorkem committed Mar 11, 2024
1 parent 4215947 commit 02a1445
Showing 1 changed file with 105 additions and 0 deletions.
105 changes: 105 additions & 0 deletions docs/src/demos/pack-and-share.sh
@@ -0,0 +1,105 @@
#!/usr/bin/env bash

#######################################################
# Demo script to show how to pack and share a model between
# a data scientist and an app developer
#######################################################


. ../demo-magic.sh


########################
# Configure the options
########################
#
# speed at which to simulate typing. bigger num = faster
#
TYPE_SPEED=25

#
# custom prompt
#
# see http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/bash-prompt-escape-sequences.html for escape sequences
#

# Reguires the kit CLI to be installed

## pull the example model we are going to use
EXAMPLE_MODEL="ghcr.io/jozu-ai/modelkit-examples/scikitlearn-tabular:latest"
NO_WAIT=true

rm -rf ~/.kitops
rm -rf model
rm -rf airsat
rm -rf deploy


mkdir model
kit unpack $EXAMPLE_MODEL -d ./model

DEMO_PROMPT="${GREEN}${CYAN}data-scientist \$ ${COLOR_RESET}"

# text color
# DEMO_CMD_COLOR=$BLACK

# hide the evidence
clear
wait

# show the contents of the model folder
pe "tree ./model"

PROMPT_TIMEOUT=3
wait

# pe "cat ./model/Kitfile"
# PROMPT_TIMEOUT=3
# wait

# pack the model into a modelkit
pe "cd model"
p " ### Packing the model, dataset, and Jupyter notebook into a ModelKit"
pe "kit pack . -t airsat:integrate"
pe "kit list"

## tag for remote
p " ### Tagging the ModelKit with remote reference"
pe "kit tag airsat:integrate ghcr.io/jozu-ai/demos/airsat:integrate"
pe "kit list"

# push the model to the remote
p " ### Pushing the ModelKit to the remote"
pe "kit push ghcr.io/jozu-ai/demos/airsat:integrate"

PROMPT_TIMEOUT=3
wait


### SWITCH TO APP DEVELOPER ###
DEMO_PROMPT="${GREEN}${CYAN}app-developer \$ ${COLOR_RESET}"
cd ..
clear

## pull the model
p " ### Pulling the ModelKit from the remote to integrate into the application"
pe "kit pull ghcr.io/jozu-ai/demos/airsat:integrate"

pe "mkdir airsat"

## unpack only the model and datasets
p " ### Unpacking only model into a directory"
pe "kit unpack ghcr.io/jozu-ai/demos/airsat:integrate --model -d ./airsat"
pe "tree ./airsat"

## tag for deployment and push
p " ### Integration is done tagging the ModelKit for deployment and pushing to the remote"
pe "kit tag ghcr.io/jozu-ai/demos/airsat:integrate ghcr.io/jozu-ai/demos/airsat:deploy"
pe "kit push ghcr.io/jozu-ai/demos/airsat:deploy"


# show a prompt so as not to reveal our true nature after
# the demo has concluded
cmd
p ""
exit

0 comments on commit 02a1445

Please sign in to comment.