Deploy a ComfyUI application
cerebrium init 1-comfyui
git clone https://github.com/comfyanonymous/ComfyUI
main.py
uses the exported ComfyUI API workflow to create an endpoint. The code:
run
functionrun
function only during initialization, while the run
function handles all subsequent requests.
We need to alter our workflow_api.json file to have placeholders so that we can replace user values on inference. You can alter the file as follows.
main.py
file below (Which runs our fastAPI server and initializes ComfyUI on application start), We created a file that contains utility functions to make it easier to work with ComfyUI. You can find the code for that helper here. Create a file named helpers.py
and copy the code into there.
cerebrium.toml
file:
cerebrium deploy
uploads both the ComfyUI directory and ~10GB of model weights. For slower connections, use our helper file to download model weights directly to the appropriate folders. Create a file called model.json
with the following contents:
cerebrium deploy
Once your ComfyUI application has been deployed successfully, you should be able to make a request to the endpoint using the following JSON payload: