Automatically install ComfyUI nodes and models and use it as a backend
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.
https://github.com/piyushK52/comfy-runner/assets/34690994/a6e25547-f721-4623-b31e-e9165c67548a
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.
Clone the repo and install the requirements. Below is a setup using python virtual environment.
git clone https://github.com/piyushK52/comfy-runner
cd comfy-runner
python3 -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt
Provide the path to your workflow and input files. (Check main.py for sample code)
from inf import ComfyRunner
runner = ComfyRunner()
runner.predict(
workflow_input="examples/img2img/i2i_workflow_api.json",
stop_server_after_completion=True
)
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()
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.