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

better support for automatically handling missing models #7

Merged
merged 28 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2f24ff3
added v1 test script (only templates dir)
dylanintech Feb 26, 2024
03dd5af
fixed selenium bugs in test scripts, incorrectly trying to access cli…
dylanintech Feb 26, 2024
18d7c1e
wip fixing the way client and prompt ids are accessed from comfyui qu…
dylanintech Feb 26, 2024
8a4acf9
tests script is working! (only tested on the default ComfyUI workflow…
dylanintech Feb 26, 2024
b298536
tests.py script works for workflows that require media to load as wel…
dylanintech Feb 26, 2024
468f04e
testing works on global machines. made replace filepaths fn dynamic s…
dylanintech Feb 26, 2024
7a2dfaa
edited driver selenium web driver to work headlessly and added anothe…
dylanintech Feb 27, 2024
3b7ce6a
added cleared workflow output boundary to test script and copied over…
dylanintech Feb 27, 2024
0d3beab
added missing model files FE
dylanintech Mar 1, 2024
ed2a27e
wip hooking up backend to FE for missing models
dylanintech Mar 3, 2024
eb34a21
wip FE should be good to go for missing model files!
dylanintech Mar 3, 2024
4ab6389
fixed some bugs in missing models FE
dylanintech Mar 3, 2024
ae84aaf
fixed skip model validation key incorrect accessing on server
dylanintech Mar 5, 2024
83b9bb1
cleaned up missing models FE
Mar 5, 2024
400c511
removed skip button on missing models ui and cleaned up FE code
dylanintech Mar 5, 2024
19aaa31
fixed dest_relative_path not being sent from missing models FE, added…
Mar 6, 2024
e8c6fea
wip
Mar 6, 2024
998ff85
added bore as cw endpoint for local testing and added chesksum logs
Mar 7, 2024
f88503f
wip
Mar 7, 2024
ee39e1d
Merge branch 'testing-pipeline' of github.com:ComfyWorkflows/comfyui-…
Mar 7, 2024
19bf145
auto-renaming for model files that already exist but with different c…
Mar 7, 2024
0f16497
wip
Mar 7, 2024
24e3371
wip
Mar 7, 2024
44dc473
wip
Mar 7, 2024
19536c0
wip
Mar 7, 2024
95ac469
fixed bug with creating blank project
Mar 7, 2024
b303a78
fixed partially resolved modal bug, added error log, etc.
Mar 7, 2024
d42cb51
Merge branch 'testing-pipeline' of https://github.com/ComfyWorkflows/…
Mar 7, 2024
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
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ show-in-file-manager==1.1.4
tqdm==4.66.2
urllib3==2.2.0
Werkzeug==3.0.1
websocket-client==1.7.0
selenium==4.18.1
Binary file modified server/.DS_Store
Binary file not shown.
Binary file added server/example.mp4
Binary file not shown.
Binary file added server/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 40 additions & 3 deletions server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from flask import Flask, jsonify, request, render_template
from showinfm import show_in_file_manager
from settings import PROJECTS_DIR, MODELS_DIR, TEMPLATES_DIR
import requests
import os, psutil, sys
from utils import (
CONFIG_FILEPATH,
Expand All @@ -23,8 +24,11 @@
set_launcher_state_data,
slugify,
update_config,
check_url_structure
)

CW_ENDPOINT = os.environ.get("CW_ENDPOINT", "http://bore.pub:24819/")

app = Flask(
__name__, static_url_path="", static_folder="../web/dist", template_folder="../web/dist"
)
Expand Down Expand Up @@ -120,7 +124,12 @@ def create_project():
if os.path.exists(template_workflow_json_fp):
with open(template_workflow_json_fp, "r") as f:
template_workflow_json = json.load(f)
launcher_json = get_launcher_json_for_workflow_json(template_workflow_json)
res = get_launcher_json_for_workflow_json(template_workflow_json)
if (res["success"] and res["launcher_json"]):
launcher_json = res["launcher_json"]
else:
return jsonify({ "success": False, "missing_models": [], "error": res["error"] })

create_comfyui_project(
project_path, models_path, id=id, name=name, launcher_json=launcher_json
)
Expand All @@ -132,6 +141,9 @@ def import_project():
request_data = request.get_json()
name = request_data["name"]
import_json = request_data["import_json"]
resolved_missing_models = request_data["resolved_missing_models"]
skipping_model_validation = request_data["skipping_model_validation"]
# skipping_model_validation = request_data.get("skipping_model_validation")

# set id to a folder friendly name of the project name (lowercase, no spaces, etc.)
id = slugify(name)
Expand All @@ -146,11 +158,36 @@ def import_project():
launcher_json = import_json
else:
print("Detected workflow json format, converting to launcher json format")
launcher_json = get_launcher_json_for_workflow_json(import_json)
#only resolve missing models for workflows w/ workflow json format
skip_model_validation = True if skipping_model_validation else False
print(f"import_project value of skip_model_validation: {skip_model_validation}")
if len(resolved_missing_models) > 0:
print(f"import_project entering for loop for resolved_missing_models: {resolved_missing_models}")
for model in resolved_missing_models:
if (model["filename"] is None or model["node_type"] is None or model["dest_relative_path"] is None):
return jsonify({ "success": False, "error": f"one of the resolved models has an empty filename, node type, or destination path. please try again." })
elif (model["source"]["url"] is not None and model["source"]["file_id"] is None):
is_valid = check_url_structure(model["source"]["url"])
if (is_valid is False):
return jsonify({ "success": False, "error": f"the url f{model['source']['url']} is invalid. please make sure it is a link to a model file on huggingface or a civitai model." })
elif (model["source"]["file_id"] is None and model["source"]["url"] is None):
return jsonify({ "success": False, "error": f"you didn't select one of the suggestions (or import a url) for the following missing file: {model['filename']}" })
skip_model_validation = True
# print(f"value of import_json: {import_json}")
print(f"value of resolved_missing_models: {resolved_missing_models}")
print(f"value of skip_model_validation: {skip_model_validation}")
res = get_launcher_json_for_workflow_json(import_json, resolved_missing_models, skip_model_validation)
if (res["success"] and res["launcher_json"]):
launcher_json = res["launcher_json"]
elif (res["success"] is False and res["error"] == "MISSING_MODELS" and len(res["missing_models"]) > 0):
return jsonify({ "success": False, "missing_models": res["missing_models"], "error": res["error"] })
else:
print(f"something went wrong when fetching res from get_launcher_json_for_workflow_json: {res}")
return
create_comfyui_project(
project_path, models_path, id=id, name=name, launcher_json=launcher_json
)
return jsonify({"success": True, "id": id})
return jsonify({"success": True, "id": id})


@app.route("/api/projects/<id>/start", methods=["POST"])
Expand Down
Loading
Loading