Home

The Story of Autoshirt

In winter 2023 a friend and myself decide to have a shot at making a business selling AI generated T-Shirts. Turns out everyone was doing this, so we're glad we didn't invest any real money into it, but it was a fun learning experience for me about AI and just how fast this field is moving.

Our idea was simple: get an AI to generate thousands of shirts on a given topic. For example if you know it's christmas coming up, why not generate 10,000 christmas themed shirts? If you know people like cats and cars, why not get an AI to spit out thousands of shirts about that. I would hack together some softare, and he'd manage actually using it and uploading to online stores. What it came down to was a pipeline. On one end a user provides a topic (eg "cars"). From that a large language model can generate a quote (eg "life in the fast lane"), and an image description (eg "a dramatic illustration of a ralley car racing through a mountain pass"). An image generation model can then turn this into a bunch of potential images. These images are too low res for printing, but can be upscaled by another AI upscaler, before finally being uploaded to an online store. It looks like this:

Gah! I thought it was supposed to be automatic? Why such a big web UI? Well, when we started this project AI wasn't very good. The available LLM would frequently generate garbage (even with good prompt engineering), and Stable Diffusion 1.5 was very hit-and-miss. So it helped to have human review at every stage of the process. Over the two months or so that I spent hobby-time on this project that changed drastically. Llama2 came out, and Stable Diffusion Xl was released, and someone fine-tuned a shirt-specific-LORA. These improvements changed our hit-rate from one in a hundred being high enough quality to one in ten.

So anyway, we stuck 50 designs up on redbubble in a week of evenings, and sold exactly zero shirts. Problem was, everyone else was doing exactly the same thing. The amount of AI generated art on etsy, redbubble, ebay etc. was exploding. We could have outpaced them in quantity (our slowest part was uploading to the store), but not in quality.


Still, there's some tech behind the scenes

Infrastructure

Hardware

This whole lot ran on a desktop PC from home, and served (at peak) 4 concurrent users. Initially the machine just had an RTX 3070 Ti, which has 8GB of VRAM. This was just enough to hold either the stable diffusion model or the LLM. And there was a memory leak in llama-cpp-python whenever you loaded/unloaded the language model, so occasionally it would die. This led to me upgrading it, first the motherboard and power supply, and then chucking in an RTX 3060 (12Gb VRAM). This prevented the software from needing to multiplex the GPU and led to way better performance. This all sat behind like 3 layers of NAT, and various wifi links, so I took the easy way out and exposed it to the internet with ngrok.

Software

The frontend was done in vite and react, and I didn't bother to use any component library. I did end up writing a minimal shirt-layout tool in canvas, which was pretty fun. Other than that most of the work was in the backend.

The backend was surprisingly complete for what it was. There six containers all up!

  1. Ngrok. This exposed Vite to the web
  2. Vite. This hosted the frontend and handled routing to the other containers
  3. Main Server. This handled sessions and logins (all hand rolled and similar to the Network Detached Storage Device I built. It was quicker to implement some cryptography rather than rely on an external service provider). Yeah, storing passwords in your own DB isn't good at production scale, but for a small project like this where there is no PII to leak? Who cares if someone steals the DB! On that topic, the DB was an Sqlite DB mounted on a volume into this server. Super simple.
  4. Image Server. This handles image generation requests, and is assigned the RTX 3070
  5. Quote Server. This handles language model requests, and is assigned the RTX 3060
The image server and quote server were the same docker image as they shared a lot of code. Scaling up this system to a moderate size would be pretty trivial because the calls to the AI were synchronous - create a pool of these servers and round-robin them. I'm pretty happy with that considering that it started life as a python script chaining some libraries together invoked in a terminal, and a month later it looked "like a proper web service".

This all worked great! What was a real pain was uploading to redbubble. There is no API for it, so lots of clicking was involved. Generating a shirt took seconds. Uploading it took dozens of clicks and minutes of human time. Arrgh! And you can't control the default shirt color, change cover images and several other thing I would have expected to be easy. It may be that I'm missing something, but we found redbubble incredibly frustrating to use.

The rate of AI Progress

Wow! This surprised me. Every week a new model was coming out. The format for LLM's was deprecated mid-project, and a 13B model at the start of the project was terrible compared to a 7B at the end. Image generation went from 256px blocky shapes to 1024px artworks. And now that I'm writing this it is even further ahead and shows no signs yet of running out of steam. Heck, Image generating AI's can now output text and typography directly.

Summary

This was a fun project, but one that I am glad I can tick off and go "done" on. We dropped it because the market was becoming flooded with other AI art, and it would have required significant investment in time and marketing to make this go anywhere. In other words it would turn into work and no longer be a "hack on it in the evenings and chat about what funny images it spat out". I'm glad we stopped, because now the functionality that is present in autoshirt - is now available natively in various print-on-demand services, so it would be rather obsolete.... Where's the code for this project? On my local gitea instance. I would make it public except that I committed the AI models via LFS to make "deployment" easier. As a result neither github or gitlab will take it unless I go to the effort of cleaning the repo.