GithubHelp home page GithubHelp logo

alexisrolland / comfyui-fastapi Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 12 KB

Boilerplate code to create a thin REST API layer on top of ComfyUI with FastAPI.

License: Apache License 2.0

Dockerfile 11.31% Python 88.69%

comfyui-fastapi's Introduction

ComfyUI-FastAPI

Boilerplate code to create a thin REST API layer on top of ComfyUI with FastAPI.

Getting started

Place a model safetensors file in the folder ./models/checkpoints, then run the following commands:

docker compose build
docker compose up

You can access the Swagger of the API at http://localhost:5000/docs.

Here is an example of payload for the /prompt endpoint, remember to update it according to your need:

  • Update the model file name in the node Load Checkpoint
  • Update the prompt in the node CLIP Text Encode (Prompt)
{
  "prompt": {
    "1": {
      "inputs": {
        "seed": 1,
        "steps": 20,
        "cfg": 8,
        "sampler_name": "dpmpp_sde",
        "scheduler": "normal",
        "denoise": 1,
        "model": [
          "2",
          0
        ],
        "positive": [
          "4",
          0
        ],
        "negative": [
          "5",
          0
        ],
        "latent_image": [
          "3",
          0
        ]
      },
      "class_type": "KSampler",
      "_meta": {
        "title": "KSampler"
      }
    },
    "2": {
      "inputs": {
        "ckpt_name": "juggernaut-xl-v10.0.safetensors"
      },
      "class_type": "CheckpointLoaderSimple",
      "_meta": {
        "title": "Load Checkpoint"
      }
    },
    "3": {
      "inputs": {
        "width": 1024,
        "height": 1024,
        "batch_size": 1
      },
      "class_type": "EmptyLatentImage",
      "_meta": {
        "title": "Empty Latent Image"
      }
    },
    "4": {
      "inputs": {
        "text": "an astronaut riding a horse",
        "clip": [
          "2",
          1
        ]
      },
      "class_type": "CLIPTextEncode",
      "_meta": {
        "title": "CLIP Text Encode (Prompt)"
      }
    },
    "5": {
      "inputs": {
        "text": "",
        "clip": [
          "2",
          1
        ]
      },
      "class_type": "CLIPTextEncode",
      "_meta": {
        "title": "CLIP Text Encode (Negative Prompt)"
      }
    },
    "6": {
      "inputs": {
        "samples": [
          "1",
          0
        ],
        "vae": [
          "2",
          2
        ]
      },
      "class_type": "VAEDecode",
      "_meta": {
        "title": "VAE Decode"
      }
    },
    "save_image_websocket_node": {
      "inputs": {
        "images": [
          "6",
          0
        ]
      },
      "class_type": "SaveImageWebsocket",
      "_meta": {
        "title": "SaveImageWebsocket"
      }
    }
  }
}

comfyui-fastapi's People

Contributors

alexisrolland avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.