ComfyUI
ComfyUI copied to clipboard
Add a Gradio websocket API interface example for running api workflows with previews/progress/interrupt
A simple interface demo showing how you can link Gradio and ComfyUI together. I know there are obviously alternatives like Forge, but being able to make complex custom api workflows and then run them from a simple UI is always great, plus Gradio works really well from phones and tablets. I left a lot of notes to help explain things. I'm sure it's not the prettiest coding, but it works and handles most of the edge cases that I could think of.
Also features: Interrupting, progress and previews.
Working previews:
Final image:
I personally recommend using the following to handle loading workflows, instead of having the mess within the code:
with open("/path/to/workflow.json", "r", encoding="utf-8") as f:
prompt = json.load(f)