#!/usr/bin/env bash
# make_image.sh — ask the Hugging Face FLUX.1-schnell model to paint a picture
# from your Mac (or any) Terminal.
#
# Setup (one time):
#   1. Get a FREE token at https://huggingface.co/settings/tokens
#   2. Save it as the HF_TOKEN environment variable so every script can find it:
#        export HF_TOKEN="hf_your_real_token_here"
#      Add the line above to ~/.zshrc so every new Terminal has it.
#
# Run it:
#   bash make_image.sh
#
# Companion lesson: https://krueng.ai/apis.html

curl https://router.huggingface.co/hf-inference/models/black-forest-labs/FLUX.1-schnell \
  -X POST \
  -H "Authorization: Bearer $HF_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"inputs": "a friendly robot painting a colorful picture"}' \
  --output robot.jpg

echo "Done! Open robot.jpg to see your picture. 🎨"
