Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
For a single image, generate every DeepFilter style transfer variant of that image
set -e
function die {
echo >&2 $1
exit 1
command -v algo >/dev/null 2>&1 || die "Have you installed the Algorithmia CLI"
test -n "$IMAGE" || die "Usage: $0 IMAGE_PATH_OR_URL"
FNAME=$(basename $IMAGE)
# If it's a local file, upload it and use that
if [[ -f $IMAGE ]]; then
algo cp $PROFILE_ARGS "$IMAGE" data://.my/temp/$FNAME
# Now loop through filters
FILTERS="alien_goggles aqua blue_brush blue_granite bright_sand cinnamon_rolls clean_view colorful_blocks \
colorful_dream crafty_painting creativity crunch_paper dark_rain dark_soul deep_connections dry_skin \
far_away gan_vogh gred_mash green_zuma hot_spicy neo_instinct oily_mcoilface plentiful post_modern \
purp_paper purple_pond purple_storm rainbow_festival really_hot sand_paper smooth_ride space_pizza \
spagetti_accident sunday yellow_collage yellow_paper"
for filter in $FILTERS; do
echo "Rendering with $filter filter..."
algo run $PROFILE_ARGS deeplearning/DeepFilter/0.1.9 -d "{\"images\": \"$IMAGE\", \"savePaths\": \"$savePath\", \"filterName\": \"$filter\"}"
algo cp $PROFILE_ARGS $savePath .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment