Skip to main content

Stable Diffusion XL ( API )

Reverse engineered API of Stable Diffusion XL 1.0 ( Midjourney Alternative ) via https://replicate.com/ , A text-to-image generative AI model that creates beautiful 1024x1024 images.

Table of Contents

Prerequisites

To use this API, you need to have the following:

Python installed on your system requests library installed

  pip install requests

Installation

To use the Claude AI Unofficial API, you can either clone the GitHub repository or directly download the Python file.

Terminal :

pip install sdxl

or

Clone the repository:

git clone https://github.com/KoushikNavuluri/stable-diffusion-xl-api.git

Usage

Import the claude_api module in your Python script:

from sdxl import ImageGenerator
  • Next, you need to create an instance of the ImageGenerator class:
client = ImageGenerator()

Send Prompt to generate image

images = sdxl.gen_image(
    "Vibrant, Headshot of a serene, meditating individual surrounded by soft, ambient lighting.")
print(images)

Output

Example Images Generated

Advanced Generation using parameters

#Parameters set to their default values
images = sdxl.gen_image(prompt=
    "Vibrant, Headshot of a serene, meditating individual surrounded by soft, ambient lighting.",count=1, width=1024, height=1024, refine="expert_ensemble_refiner", scheduler="DDIM", guidance_scale=7.5, high_noise_frac=0.8, prompt_strength=0.8, num_inference_steps=50)
print(images)

List of parameters

  *   prompt = Input text prompt
  *   width  = Width of output image(max:1024)
  *   height = height of output image(max:1024)
  *   count  = Number of images to output. (minimum: 1; maximum: 4) 
  *   refine = Which refine style to use ( no_refiner or expert_ensemble_refiner or base_image_refiner )
  *   scheduler = scheduler (valid_schedulers = ["DDIM" or "DPMSolverMultistep" or "HeunDiscrete" or "KarrasDPM" or "K_EULER_ANCESTRAL" or "K_EULER" or "PNDM"])
  *   guidance_scale = Scale for classifier-free guidance (minimum: 1; maximum: 50) 
  *   prompt_strength = Prompt strength in image (maximum: 1) 
  *   num_inference_steps = Number of denoising steps (minimum: 1; maximum: 500) 
  *   high_noise_frac = for expert_ensemble_refiner, the fraction of noise to use (maximum: 1)

CLI Version

For cli version you can check example folder in this repository (filename:cli.py)

How to:

python main.py "beautiful landscape with two kittens,realistic,4k" --count 1 --width 1024 --height 1024 --refine expert_ensemble_refiner --scheduler DDIM --guidance_scale 7.5 --high_noise_frac 0.6 --prompt_strength 0.9 --num_inference_steps 40

Disclaimer

This project provides an unofficial API for Replicate's Stable Diffusion XL and is not affiliated with or endorsed by Replicate or Stable Diffusion. Use it at your own risk.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for sdxl 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sdxl 1.0.0
File Size Uploaded
sdxl-1.0.0.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sdxl 1.0.0
File Interpreter ABI Platform
sdxl-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 kB

Release files / sdxl-1.0.0.tar.gz

Download URL sdxl-1.0.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
389be1a73ce368f8e3c402900b543223130cf485338e8e1977ab99d760cd5e79
BLAKE2b-256 checksum
How to use checksums
a072e8e46f1c2de0df7958f5ab37c519e7370b30b5751cc8b70a942bed0653b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / sdxl-1.0.0-py3-none-any.whl

Download URL sdxl-1.0.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e6086719567126c1ac3bba6e3f07d7bedfc1d602c758b0b5960c6a786d53e4b
BLAKE2b-256 checksum
How to use checksums
809750be0d2ea23991dea595f4c33031a1f14fe94975a434b1b69177ac3e2654
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page