|
3 weeks ago | |
---|---|---|
.. | ||
README.md | 3 weeks ago | |
cat_0.png | 3 weeks ago | |
cat_1.png | 3 weeks ago | |
cat_2.png | 3 weeks ago | |
cat_3.png | 3 weeks ago | |
cat_4.png | 3 weeks ago | |
generate_cat_images.py | 3 weeks ago |
README.md
Image Generation AUTOMATIC1111 API (sd3_medium
and clip
)
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.
In addition to image generation, the example also shows how to use the server's CLIP Interrogator endpoint to generate captions from the created images.
Server Details
For this example, the AUTOMATIC1111 server is running on the following network details:
- IP Address:
172.30.200.3
- Custom Port:
35000
You can use these details to interact with the server for:
- Image Generation: Sending requests to the
/sdapi/v1/txt2img
endpoint. - CLIP Interrogation: Sending requests to the
/sdapi/v1/interrogate
endpoint.
This means if you want to use the server for generating images or obtaining image captions via CLIP interrogation, you should point your API calls to http://172.30.200.3:35000
.
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:
pip install requests Pillow