I wanted some practice with React, so I created a React app that concurrently generates 6 images using Modal. It didn’t matter if you generated one or six images, the speed would be consistent.
I hosted the React front end using an Ec2 instance and Docker. The backend was a serverless setup using Modal. My Modal server used FastAPI, which would then creat 1-6 instances of a Stable Diffusion api for generating the images concurrently.
The backend, Modal piece, can be viewed here: https://github.com/jaydrennan/generation_scaling