This project is an ai based data pipeline. You start by suppling an idea for a category of t-shirt. When the pipeline runs, it does a number of things:
- generates
p
number of patterns using the suppliedidea
- generates an image with a transparent background with the generated text
- uploads these images to github
- lists and publishes all the new patterns on printify
From there, Printify takes over and the following things happen
- products are synced with shopify, and a number of other retailers
- orders are automatically sent to the print provider when a sale is made
There are two ways this can be run. The first is as a command line utility, and the second is as a web service. to run it as a command line utility, run the following command:
python3.12 product_pipeline.py -p 10 "Idea for a t-shirt"
In order to run the application as a web service, run the following command:
uvicorn product_pipeline:app --host localhost --port 8080 --reload
Stay tuned for the deployment to GCP!
Run the following command to generate the required .env
file. Replace the empty strings with the appropriate values.
cat <<EOF > .env
PRINTIFY_API_KEY=""
OPENAI_API_KEY=""
GH_PAT=""
GH_UPLOAD_REPO=""
GH_CONTENT_PREFIX=""
EOF
Additionally, the shopify utility requires these envronment variables to be set:
echo 'SHOPIFY_API_KEY=""' >> .env
echo 'SHOPIFY_API_ACCESS_TOKEN=""' >> .env
echo 'SHOPIFY_SHOP_NAME=""' >> .env
Formal unit tests are not yet implemented. However, all the functions have a manual test if you run the script directly.
clear && flake8 --ignore=E501 --exclude=.venv
curl -X POST "http://localhost:8080/process_patterns" \
-H "Content-Type: application/json" \
-d '{"patterns": 1, "idea": "unit testing"}'
python3.12 image_util.py
python3.12 ai_util.py