fofr / any-comfyui-workflow

Run any ComfyUI workflow. Guide: https://github.com/fofr/cog-comfyui

  • Public
  • 726.4K runs
  • GitHub
  • Paper
  • License

Run time and cost

This model costs approximately $0.0052 to run on Replicate, or 192 runs per $1, but this varies depending on your inputs. It is also open source and you can run it on your own computer with Docker.

This model runs on Nvidia L40S GPU hardware. Predictions typically complete within 6 seconds.

Readme

Read guidance: https://github.com/fofr/cog-comfyui

Weights licenses: https://github.com/fofr/cog-comfyui/blob/main/weights_licenses.md

Follow me on Twitter @fofrAI


We recommend:

  • trying it with your favorite workflow and making sure it works
  • writing code to customise the JSON you pass to the model, for example changing seeds or prompts
  • using the Replicate API to run the workflow

TLDR: json blob -> img/mp4

What’s included

We’ve tried to include many of the most popular model weights:

Raise an issue to request more custom nodes or models, or use this model as a template to roll your own.

How to use

1. Get your API JSON

You’ll need the API version of your ComfyUI workflow. This is different to the commonly shared JSON version, it does not included visual information about nodes, etc.

To get your API JSON:

  1. Turn on the “Enable Dev mode Options” from the ComfyUI settings (via the settings icon)
  2. Load your workflow into ComfyUI
  3. Export your API JSON using the “Save (API format)” button

2. Gather your input files

If your model takes inputs, like images for img2img or controlnet, you have 3 options:

Use a URL

Modify your API JSON file to point at a URL:

- "image": "/your-path-to/image.jpg",
+ "image": "https://example.com/image.jpg",

Upload a single input

You can also upload a single input file when running the model.

This file will be saved as input.[extension] – for example input.jpg. It’ll be placed in the ComfyUI input directory, so you can reference in your workflow with:

- "image": "/your-path-to/image.jpg",
+ "image": "image.jpg",

Upload a zip file or tar file of your inputs

These will be downloaded and extracted to the input directory. You can then reference them in your workflow based on their relative paths.

So a zip file containing:

- my_img.png
- references/my_reference_01.jpg
- references/my_reference_02.jpg

Might be used in the workflow like:

"image": "my_img.png",
...
"directory": "references",

Run your workflow

With all your inputs updated, you can now run your workflow.

Some workflows save temporary files, for example pre-processed controlnet images. You can also return these by enabling the return_temp_files option.