diff --git a/install_comfyui.py b/install_comfyui.py index b943042..47671c4 100644 --- a/install_comfyui.py +++ b/install_comfyui.py @@ -5,9 +5,22 @@ default_install_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ComfyUI') -def main(install_location): +def main(install_location, should_install_manager=False): + repo_url = 'https://github.com/comfyanonymous/ComfyUI.git' + install_repo(repo_url, install_location) + + if should_install_manager: + manager_repo_url = 'https://github.com/ltdrdata/ComfyUI-Manager.git' + manager_location = manager_location_from_comfyui_location(install_location) + install_repo(manager_repo_url, manager_location) + + +def manager_location_from_comfyui_location(comfyui_location): + return os.path.join(comfyui_location, 'custom_nodes', 'ComfyUI-Manager') + + +def install_repo(git_repo_url, install_location): import git - git_repo_url = 'https://github.com/comfyanonymous/ComfyUI.git' os.mkdir(install_location) git.Repo.clone_from(git_repo_url, install_location) diff --git a/lib_comfyui/webui/tab.py b/lib_comfyui/webui/tab.py index 7e7d9ac..345b623 100644 --- a/lib_comfyui/webui/tab.py +++ b/lib_comfyui/webui/tab.py @@ -24,6 +24,9 @@ def create_tab(): gr.Markdown(comfyui_install_instructions_markdown) with gr.Column(): + with gr.Row(): + install_manager = gr.Checkbox(label='Install with ComfyUI-Manager', value=True) + with gr.Row(): install_path = gr.Textbox(placeholder=f'Leave empty to install at {install_comfyui.default_install_location}', label='Installation path') @@ -33,7 +36,7 @@ def create_tab(): with gr.Row(): installed_feedback = gr.Markdown() - install_button.click(automatic_install_comfyui, inputs=[install_path], outputs=[installed_feedback], show_progress=True) + install_button.click(automatic_install_comfyui, inputs=[install_manager, install_path], outputs=[installed_feedback], show_progress=True) gradio_utils.ExtensionDynamicProperty( key='workflow_type_ids', @@ -44,7 +47,7 @@ def create_tab(): @ipc.restrict_to_process('webui') -def automatic_install_comfyui(install_location): +def automatic_install_comfyui(should_install_manager, install_location): from modules import shared install_location = install_location.strip() if not install_location: @@ -55,7 +58,7 @@ def automatic_install_comfyui(install_location): print(message, file=sys.stderr) return gr.Markdown.update(message) - install_comfyui.main(install_location) + install_comfyui.main(install_location, should_install_manager) shared.opts.comfyui_install_location = install_location return gr.Markdown.update('Installed! Now please reload the UI.') @@ -68,10 +71,10 @@ def can_install_at(path): comfyui_install_instructions_markdown = ''' ## ComfyUI extension -It looks like your ComfyUI installation isn't set up yet! +It looks like your ComfyUI installation isn't set up yet. If you already have ComfyUI installed on your computer, go to `Settings > ComfyUI`, and set the proper install location. -Alternatively, if you don't have ComfyUI installed, you can install it with this button: +Alternatively, if you don't have ComfyUI installed, you can install it here: '''