fiatrete / SDCN-Stable-Diffusion-Computing-Network

SDCN is an infrastructure that allows people to share and use Stable Diffusion computing power easily.
https://sdcn.info
MIT License
31 stars 12 forks source link
ai aigc infras infrastructure stable-diffusion

SDCN logo

License PRs Welcome GitHub Contributors Last Commit

Website | Playground | API Docs

Overview

SDCN is an infrastructure for sharing Stable Diffusion computing power

SDCN structure

Why SDCN?


Getting Started

Try out SDCN functionalities in SDCN website.

๐ŸŽˆFeel free to file tickets for bugs or feature requests.


๐Ÿ“ฑ How-to: try out SDCN API

SDCN provide SaaS-like API from https://api.sdcn.info

Using dan_run.py script

Try the sample code in example folder.

You can modify the example/params-xxx.json to experiment with different parameter combinations.

python3 dan_run.py txt2img params-txt2img.json OUTPUT_IMAGE.png
python3 dan_run.py img2img params-img2img.json ORIGINAL_IMAGE.png OUTPUT_IMAGE.png

Using curl

  1. Install curl and jq
    brew install curl jq
  2. Enter example folder and execute
    cd example
    cat params-txt2img.json \
    | curl --location --request POST 'https://api.sdcn.info/api/sd/txt2img' \
    --header 'Content-Type: application/json' -d @- \
    | jq '.data.images[0]' |tr -d '\"' | tr -d '\\' | base64 -d > out.png

๐Ÿ‘‰ SDCN API refer to API Docs


๐ŸŒ How-to: contribute computing power to sdcn.info

  1. Register a donor account on sdcn.info
  2. Install lastest Stable Diffusion WebUI on your PC or Server
  3. Start according to README.md in the dan-node file


๐Ÿ”จ How-to: run dan-server locally in Docker

  1. Install lastest Stable Diffusion WebUI and Docker on your PC or Server

  2. Register a donor account on sdcn.info

  3. Start according to README.md in the dan-node file

  4. Register a new github OAuth Application set callback url: http://localhost:6006/api/user/connect/github. Get the github client ID and SECRET:, then set in the docker-compose.yml.

  5. Start dan-server locally in docker with Docker Compose:

    docker-compose up -d 

Now your dan-server is available on "http://127.0.0.1:6006"

  1. Register your Stable Diffusion WebUI instance as a SDCN node:

โš ๏ธ Please note that you must use non-loopback IP address in your node's address! You cannot use 127.0.0.1 or 'localhost' since our docker container's hostnet is not enabled.

  1. Config SERVICE_PREFIX in example/dan_run.py to "http://127.0.0.1:6006".
SERVICE_PREFIX = 'http://127.0.0.1:6006'
  1. Execute the example with your local dan-server:
python3 dan_run.py txt2img params-txt2img.json OUTPUT_IMAGE.png


Roadmap


License

This project is licensed under the MIT license


Credits