Deploy your ComfyUI workflow as an API endpoint
comfyui-truss
directory
config.yaml
data/comfy_ui_workflow.json
config.yaml
build_commands
. Build commands are shell commands that get run during the build stage of the docker image.
In this example, the first two lines clone the ComfyUI repository and install the python requirements.
The latter commands install various custom nodes and models and place them in their respective directory within the ComfyUI repository.
data/comfy_ui_workflow.json
comfy_ui_workflow.json
contains the entire ComfyUI workflow in an API compatible format. This is the workflow that will get executed by the ComfyUI server.
Here is the workflow we will be using for this example.
Anime Style Transfer Workflow
{{handlebars}}
templating style.
If there are any inputs in your ComfyUI workflow that should be variables such as input prompts, images, etc, you should templatize them using the handlebars format.
In this example workflow, there are two inputs: {{input_image}}
and {{prompt}}
When making an API call to this workflow, we will be able to pass in any variable for these two inputs.
config.yaml
and data/comfy_ui_workflow.json
filled out we can deploy this workflow just like any other model on Baseten.
pip install truss --upgrade
truss push --publish
prompt
and input_image
. In our API call we can specify the values for these two variables like so: