jordenyt / ComfyuiGW

A Restful API Gateway for ComfyUI
4 stars 1 forks source link

Linux version... #1

Open scruffynerf opened 4 days ago

scruffynerf commented 4 days ago

Will you take a patch for a linux version? You have a bunch of 'windows-isms' in here.

jordenyt commented 4 days ago

Good idea. Let me try to make it.

jordenyt commented 4 days ago

@scruffynerf Added script and updated code to support Linux. As I don't have a chance to test it on Linux, could you please help to check whether it can be run?

scruffynerf commented 3 days ago

Mostly good, minor bugs:

# Use provided path or default
COMFYUI_PATH=~/Workspace/ComfyUI

should be EXPORT COMFYUI_PATH

You also use python3 on line 8 but python on line 32, and should be python3 always (since python isn't guaranteed to be there, nor always python 3, but python3 is.

Testing still...

BTW, a few points: you assume comfyUI isn't running (bad assumption) I think turning on/off (and or restarting it) should be options

ALSO, more importantly: seriously consider using this instead? https://github.com/hiddenswitch/ComfyUI (this 'looks' like a simple fork, but actually @doctorpangloss wrote this fork, as a Long Term Supported Fork) that does 2 things: 1) makes comfyui into a full python library 2) "Start ComfyUI by creating an ordinary Python object. This does not create a web server. It runs ComfyUI as a library, like any other package you are familiar with:" You can do all of the same stuff you're doing now, BUT also set it up a standalone GW, so someone using ComfyUI doesn't have to touch their existing setups, this would be your GW version, and 'just work' for people. Basically you'd be making it a one click to install a Restful ComfyUI server.

scruffynerf commented 3 days ago

So I got this working... it's a bit 'fragile' with the json (especially the pasting in of new items), and doesn't handle bad json well at all (meaning it all crashes, and reseting is a pain due to the comfyUI running still)

It's a start though, and you have created something I've waited for a while to get... so Congrats!

jordenyt commented 3 days ago

I have committed the fix for export and python3 issues. Thanks for testing!

It is a good suggestion to use hiddenswitch/ComfyUI as the core ComfyUI and make the GW as a standalone app. Maybe I will make a branch for people who just want single script for installation. The current architecture was designed as a way to provide extra-function for A1111's sdweb-ui in the beginning. Therefore when ComfyUI came as a supported function, the idea was trying to run ComfyUI in an external path, as I was thinking the GW will support more new projects later.

I agree that the script is quite 'fragile' for bad JSON. In my usage, it is quite rare that I have a new workflow / mode and therefore I didn't put time on making the script more robust on this. I will handle the bad JSON later and I also need to update the Android app for the JSON error handling.

To now, there is just a few people tried to use this project. Your suggestion is valuable for me to understand what people are looking for. Thanks for giving a look on my project and your feedback!

jordenyt commented 3 days ago

BTW, if you don't want the GW to control the on/off of ComfyUI, you can remove this line:

start_comfyui()

at the end of comfyui_server.py
and make sure the ComfyUI address is accessible by the script:

comfyui_server = "127.0.0.1:8188"