stableDiffusion-API

This is a Flask-based web application that generates images using the SDXL ImageGenerator library. Users can send prompts to the app and receive generated images in response.

Table of Contents

Requirements

To run this application, you need to have the following installed:

  • Python (3.6 or higher)
  • Flask
  • Flask-CORS
  • SDXL ImageGenerator

Installation

  1. Clone this repository to your local machine:

    git clone https://github.com/h4shell/stableDiffusion-API.git
    cd stableDiffusion-API
  2. Install the required packages using pip:

    pip install -r requirements.txt

Usage

  1. Start the Flask server by running the following command:

    python server.py

    The server will start and listen on http://0.0.0.0:5000/.

  2. You can now send HTTP requests to the server to generate images based on prompts.

Endpoints

Generate Image

  • URL: /

  • Method: GET

  • Parameters:

    • prompt (string, required): The prompt text for image generation.
    • count (string, optional): number of images in output.
  • Response:

    • If successful:
      {
        "image": "https://replicate.delivery/pbxt/.."
      }
    • If an error occurs:
      {
        "status": false,
        "error": "error_message"
      }

Example

Assuming the server is running on http://localhost:5000/, you can generate images by sending a GET request with the prompt parameter:

curl "http://localhost:5000/?prompt=beautiful%20landscape"

Response:

{
  "image": "https://replicate.delivery/pbxt/.."
}

Contributing

Contributions are welcome! If you find any issues or want to enhance this project, feel free to submit a pull request.

License

This project is licensed under the MIT License.