Coder Social home page Coder Social logo

comfy_runner's Introduction

Comfy Runner

Setup and run comfy workflows. This tool automatically downloads all the neccessary nodes and models and executes the provided workflow. This repo can make it easier for people to use ComfyUI as a backend.

Follow this demo video to quickly set it up or follow the "How to use" guide below

quick_demo.mp4

Features

  • Auto installs missing nodes
  • Auto downloads workflow models. (Check the data folder for supported models)
  • Executes the workflow without starting the UI server
  • Suggests similar models if the ones in the workflow are not found
  • Link to custom nodes and models can be provided for installation/Setup

How to use

1. Save the workflow as API json

After loading the workflow into ComfyUI turn on the "Enable Dev mode Options" from the ComfyUI settings. Click on "Save (API format)" button to save the workflow in API json format.

2. Clone the repo

Clone the repo and install the requirements. Below is a setup using python virtual environment.

git clone https://github.com/piyushK52/comfy-runner
python3 -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt

3. Run

Provide the path to your workflow and input files. (Check main.py for sample code)

from comfy_runner.inf import ComfyRunner

runner = ComfyRunner()
output = runner.predict(
    workflow_input="comfy_runner/examples/txt2img/workflow_api.json",
    stop_server_after_completion=True,
)

print("final output: ", output)

Other parameters that can be passed in this method

Param Description
workflow_input API json of the workflow. Can be a filepath or str
file_path_list Files to copy inside the '/input' folder which are being used in the workflow
extra_models_list Extra models to be downloaded
extra_node_urls Extra nodes to be downloaded (with the option to specify commit version)
stop_server_after_completion Stop server as soon as inference completes (or fails)
clear_comfy_logs Clears the temp comfy logs after every inference
output_folder For storing inference output (defaults to ./output)
output_node_ids Nodes to look in for the output
ignore_model_list These models won't be downloaded (in cases where these are manually placed)
client_id This can be used as a tag for the generations
comfy_commit_hash Specific comfy commit to checkout

If you are running multiple queries then you can use stop_server_after_completion=False and after completion manually stop the server using runner.stop_server() Please check the main.py for some code examples or the video above.

You can also stop the current generation using stop_current_generation

runner = ComfyRunner()
runner.stop_current_generation(client_id=xyz, retry_window=10)    # xyz is the client_id used for starting the gen

Roadmap

  • Add support for normal workflow json and image files
  • Publish this as a library for easy usage

Feedback

Open issues/discussion if you want to suggest changes or have feature requests. This repo was basically created in an effort to make it easier for people to use ComfyUI as a backend in their apps and decrease their setup time.

comfy_runner's People

Contributors

piyushk52 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

comfy_runner's Issues

Civitai下载错误

INFO:app_logger:Downloading dynavisionXLAllInOneStylized_release0534bakedvae.safetensors
INFO:app_logger:Error generating output HTTPSConnectionPool(host='civitai.com', port=443): Max retries exceeded with url: /api/download/models/169718 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001EF62D60A10>, 'Connection to civitai.com timed out. (connect timeout=None)'))
DEBUG:app_logger:Process 20724 (Port 6969)

链接错误有啥解决方法嘛

test

simple_demo.mp4

Can you make a video tutorial on how to use this?

I think this will become viral very soon since literally 99% of the public workflows are broken and impossible to fix manually for most people; please, please, if you have 1 or 2 hours, can you record a 10 minute tutorial on how to fully make a workflow work thanks to this amazing script?

Thank you for your work, we all need this.

Is there a way to make the downloads optional? (prompted?)

hello! Very cool stuff and very much needed given how fast thigns are moving (Svd img2vid 1.1 just came out this am).

Quick q: is there a way to tell comfy runner to execute step by step and prompted?
For example, it could warn you: "checkpoint xyz is missing, do you want to download it? "

reasons include:
a) files tend to be extremely large
b) sometimes someone will push a worflow and include the 'wrong' models - this is seen with ipadapter for example where you had 2 alternatives to face ID come out in a week straight, forcing Youtubers who make tutorials to redo their videos and even the node creators to re-engineer their solutions.

Thank you!

def is_api_json(data) is too strict with its requirement that every dict have a 'class_type', invalidates many workflows

as the title says, I was trying to figure out how to use this tool and it kept saying "invalid workflow" when I tried to use workflows downloaded from various workflow websites. After digging in I found this hard requirement inside is_api_json and it did not seem all that reasonable.. in my case I just commented it out and then I was able to get it to work. I figure other less tech-savvy people would not go this far and just assume the tool doesn't work.. that would be a shame because it's a great tool!

I do wish it had a few extra ways to use it.. I'd like to be able to pass flags that would have it only report on the status of whether a workflow is "ready to use" by determining if anything is missing or unresolved. I'd like to be able to see only what's missing.. and if any of the missing nodes or models are unresolved. And then also have the ability to only download missing nodes or missing models. I'd also like to be able to skip installing ComfyUI and only do the above, assuming an existing ComfyUI installation is somewhere else.

Portable Comfyui Version

How do you run script in python embeded evironment if have another python version installed in win for a1111?

source ./venv/bin/activate failed

anyone met in windows system.
"'source' is not recognized as an internal or external command, executable program or batch file."

source ./venv/bin/activate

change to

.\venv\Scripts\activate

Cant make it run on Windows

Hello, I followed the installation documentation, but still cant make it run on Windows

E:\01ComfyUI\ComphyRunner> python main.py
Traceback (most recent call last):
File "E:\01ComfyUI\ComphyRunner\main.py", line 4, in
from comfy_runner.inf import ComfyRunner
ModuleNotFoundError: No module named 'comfy_runner'

Launch error

(Using Windows 10) After adding correct input paths to main.py and using "(venv) E:\Comfy-Runner\comfy-runner>python main.py" I receive the error :

"INFO:app_logger:Error generating output Expecting value: line 1 column 1 (char 0)
final output: {}"

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.