From 0fd0ee684521a6e749fa778da5abb8eb092640f8 Mon Sep 17 00:00:00 2001 From: Anindya Maiti Date: Sat, 22 Feb 2025 20:27:19 -0600 Subject: [PATCH] Update 'api-txt2img/README.md' --- api-txt2img/README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/api-txt2img/README.md b/api-txt2img/README.md index e69de29..676c44c 100644 --- a/api-txt2img/README.md +++ b/api-txt2img/README.md @@ -0,0 +1,25 @@ +# Image Generation Example with AUTOMATIC1111 API + +This example demonstrates how to use Python to generate images of a cat using the AUTOMATIC1111 Stable Diffusion API on a custom port. In this example, we'll generate **5 images** using a fixed prompt and save them locally as PNG files. + +## Overview + +The provided Python script does the following: +- Generates a random seed for each image. +- Sends a POST request to the AUTOMATIC1111 `txt2img` API endpoint with specified model parameters, a prompt, and a custom port. +- Decodes the returned base64 image data. +- Saves each image in the local directory as a PNG file. + +## Prerequisites + +Before running the script, ensure you have: + +- A working Python 3 environment. +- The following Python packages installed: + - `requests` + - `Pillow` + +You can install these packages using pip: + +```bash +pip install requests Pillow