Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to install manager on install page #173

Merged
merged 4 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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