Skip to content

Commit

Permalink
allow to install manager on install page (#173)
Browse files Browse the repository at this point in the history
* allow to install manager on install page

* put install script in install_comfyui

* refact
  • Loading branch information
PladsElsker authored Nov 5, 2023
1 parent a10f2f1 commit 2e27444
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
17 changes: 15 additions & 2 deletions install_comfyui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
13 changes: 8 additions & 5 deletions lib_comfyui/webui/tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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',
Expand All @@ -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:
Expand All @@ -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.')
Expand All @@ -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:
'''


Expand Down

0 comments on commit 2e27444

Please sign in to comment.