new comfyUI
@@ -0,0 +1,20 @@
|
||||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
# Change these settings to your own preference
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
max_line_length = 120
|
||||
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
@@ -0,0 +1,164 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: { browser: true, es2020: true },
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:@typescript-eslint/recommended-type-checked',
|
||||
'plugin:@typescript-eslint/stylistic-type-checked'
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['@typescript-eslint', 'import'],
|
||||
parserOptions: {
|
||||
// tsconfigRootDir: __dirname,
|
||||
sourceType: 'module',
|
||||
ecmaVersion: 'latest',
|
||||
ecmaFeatures: {
|
||||
// experimentalObjectRestSpread: true,
|
||||
modules: true,
|
||||
legacyDecorators: true
|
||||
},
|
||||
project: ['./tsconfig.json'],
|
||||
},
|
||||
rules: {
|
||||
// 'import/extensions': [
|
||||
// 'error',
|
||||
// "ignorePackages",
|
||||
// {
|
||||
// "js": "always",
|
||||
// "ts": "never"
|
||||
// }
|
||||
// ],
|
||||
'import/no-unresolved': ['off'],
|
||||
'class-methods-use-this': ['off'],
|
||||
'radix': ['off'],
|
||||
'import/prefer-default-export': ['off'],
|
||||
'implicit-arrow-linebreak': ['off'],
|
||||
'no-trailing-spaces': [
|
||||
'error', {
|
||||
'skipBlankLines': true,
|
||||
'ignoreComments': true,
|
||||
},
|
||||
],
|
||||
'max-len': [
|
||||
'error', {
|
||||
'code': 120,
|
||||
},
|
||||
],
|
||||
'prefer-rest-params': ['off'],
|
||||
|
||||
'import/no-extraneous-dependencies': [
|
||||
'error', {
|
||||
'devDependencies': ['**/__tests__/*.ts', '**/__mocks__/*.ts'],
|
||||
},
|
||||
],
|
||||
|
||||
'one-var': ['off'],
|
||||
|
||||
// false positive https://github.com/typescript-eslint/typescript-eslint/issues/2483
|
||||
'no-shadow': 'off',
|
||||
'object-curly-newline': ["error", {
|
||||
"ObjectExpression": { "multiline": true, "minProperties": 1 },
|
||||
"ObjectPattern": { "multiline": true, "minProperties": 1 },
|
||||
"ImportDeclaration": {"multiline": true, "minProperties": 8 },
|
||||
"ExportDeclaration": { "multiline": true, "minProperties": 1 }
|
||||
}],
|
||||
"@typescript-eslint/explicit-function-return-type": 'error',
|
||||
'@typescript-eslint/triple-slash-reference': 'off',
|
||||
'@typescript-eslint/no-shadow': 'error',
|
||||
'@typescript-eslint/no-unsafe-argument': 'off',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'off',
|
||||
'@typescript-eslint/no-unsafe-return': 'off',
|
||||
'@typescript-eslint/no-unsafe-call': 'off',
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
||||
'@typescript-eslint/consistent-type-definitions': 'off',
|
||||
'@typescript-eslint/no-unused-expressions': [
|
||||
'error',
|
||||
{
|
||||
'allowShortCircuit': true,
|
||||
'allowTernary': true,
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-use-before-define': ['off'],
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{'argsIgnorePattern': '^_'},
|
||||
],
|
||||
'@typescript-eslint/explicit-module-boundary-types': [
|
||||
'off', {
|
||||
allowArgumentsExplicitlyTypedAsAny: true,
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/ban-ts-comment': [
|
||||
'off',
|
||||
{'ts-expect-error': 'allow-with-description'},
|
||||
],
|
||||
'@typescript-eslint/no-empty-function': [
|
||||
'error',
|
||||
{
|
||||
'allow': [
|
||||
'methods',
|
||||
'asyncMethods',
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
'lines-between-class-members': 'off',
|
||||
'@typescript-eslint/lines-between-class-members': 'off',
|
||||
|
||||
'curly': ['error', 'multi-line', 'consistent'],
|
||||
'no-unused-vars': 'off',
|
||||
'jest/no-test-prefixes': 'off',
|
||||
'jest/no-focused-tests': 'off',
|
||||
'comma-dangle': ['error', 'only-multiline'],
|
||||
'linebreak-style': ['error', 'unix'],
|
||||
'quotes': ['error', 'single'],
|
||||
'semi': ['error', 'always'],
|
||||
'eqeqeq': ['error', 'always'],
|
||||
'complexity': [
|
||||
'error', {
|
||||
max: 8,
|
||||
},
|
||||
],
|
||||
'block-scoped-var': 'error',
|
||||
'no-else-return': [
|
||||
'error', {
|
||||
allowElseIf: true,
|
||||
},
|
||||
],
|
||||
'no-debugger': 'off',
|
||||
'no-eval': 'error',
|
||||
'no-lone-blocks': 'error',
|
||||
'no-multi-spaces': 'error',
|
||||
'no-useless-return': 'error',
|
||||
'no-var': 'error',
|
||||
'no-console': [
|
||||
// 'error', {
|
||||
// allow: ['warn', 'error'],
|
||||
// },
|
||||
'off',
|
||||
],
|
||||
'no-throw-literal': 'error',
|
||||
'newline-per-chained-call': [
|
||||
'error', {
|
||||
ignoreChainWithDepth: 4,
|
||||
},
|
||||
],
|
||||
'no-extra-boolean-cast': [
|
||||
'error', {
|
||||
enforceForLogicalOperands: true,
|
||||
},
|
||||
],
|
||||
'no-fallthrough': 'error',
|
||||
'no-use-before-define': 'off',
|
||||
'no-case-declarations': 'off',
|
||||
},
|
||||
ignorePatterns: [
|
||||
'node_modules',
|
||||
'web/**/*.d.ts',
|
||||
'web/**/*.js'
|
||||
],
|
||||
globals: {},
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
__Please attach a workflow file to make it easier for others to reproduce the error!__
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Error in console:**
|
||||
If applicable, add the error message from the console.
|
||||
|
||||
**Versions:**
|
||||
Copy the output of the console (4 parts), like this:
|
||||
```
|
||||
** Python version: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
|
||||
```
|
||||
```
|
||||
Total VRAM 12287 MB, total RAM 130996 MB
|
||||
Set vram state to: NORMAL_VRAM
|
||||
```
|
||||
```
|
||||
[Crystools INFO] Crystools version: 1.9.2
|
||||
[Crystools INFO] CPU: AMD Ryzen 9 5950X 16-Core Processor - Arch: AMD64 - OS: Windows 10
|
||||
[Crystools INFO] GPU/s:
|
||||
[Crystools INFO] 0) NVIDIA GeForce RTX 3080 Ti
|
||||
[Crystools INFO] NVIDIA Driver: 546.33
|
||||
```
|
||||
```
|
||||
### Loading: ComfyUI-Manager (V1.25.3)
|
||||
### ComfyUI Revision: 1886 [6a10640f] | Released on '2024-01-08'
|
||||
```
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -0,0 +1,155 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
*.pyc
|
||||
|
||||
.idea
|
||||
/node_modules
|
||||
@@ -0,0 +1,26 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="ComfyUI" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="ComfyUI" />
|
||||
<option name="ENV_FILES" value="" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
<env name="CRYSTOOLS_LOGLEVEL" value="10" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="SDK_NAME" value="Python 3.11 (.env)" />
|
||||
<option name="WORKING_DIRECTORY" value="E:\AI\SD\comfyUI\ComfyUI" />
|
||||
<option name="IS_MODULE_SDK" value="false" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" />
|
||||
<option name="PARAMETERS" value="--windows-standalone-build --extra-model-paths-config ..\extra_model_paths.yaml --output-directory ..\..\comfyUI.output --input-directory ..\..\comfyUI.input --disable-auto-launch" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -0,0 +1,12 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="lint" type="js.build_tools.npm">
|
||||
<package-json value="$PROJECT_DIR$/custom_nodes/ComfyUI-Crystools/package.json" />
|
||||
<command value="run" />
|
||||
<scripts>
|
||||
<script value="lint" />
|
||||
</scripts>
|
||||
<node-interpreter value="project" />
|
||||
<envs />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd ../comfyUI/ComfyUI
|
||||
rm ./custom_nodes/ComfyUI-Crystools/web/*.js -f
|
||||
|
||||
LOCAL_COMMAND="npm --prefix ./custom_nodes/ComfyUI-Crystools run validate"
|
||||
OUTPUT=$($LOCAL_COMMAND 2>&1)
|
||||
EXIT_CODE=$?
|
||||
|
||||
if [ $EXIT_CODE -eq 0 ]; then
|
||||
echo "Validate ok"
|
||||
cd ../../ComfyUI-Crystools
|
||||
else
|
||||
echo "Validate KO!"
|
||||
echo $OUTPUT
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOCAL_COMMAND="python .others/version.py"
|
||||
|
||||
OUTPUT=$($LOCAL_COMMAND 2>&1)
|
||||
EXIT_CODE=$?
|
||||
|
||||
if [ $EXIT_CODE -eq 0 ]; then
|
||||
echo "Version changed"
|
||||
else
|
||||
echo "Can't change the version! check the .other/version.py"
|
||||
echo $OUTPUT
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git add __init__.py core/version.py web/*.js
|
||||
@@ -0,0 +1,12 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="typescript" type="js.build_tools.npm">
|
||||
<package-json value="$PROJECT_DIR$/custom_nodes/ComfyUI-Crystools/package.json" />
|
||||
<command value="run" />
|
||||
<scripts>
|
||||
<script value="start" />
|
||||
</scripts>
|
||||
<node-interpreter value="project" />
|
||||
<envs />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -0,0 +1,40 @@
|
||||
import os
|
||||
|
||||
print("-- Setting up the version --")
|
||||
|
||||
versionLabel = "@version:"
|
||||
version_file = os.path.join(os.path.dirname(__file__), "../version")
|
||||
|
||||
with open(version_file, "r") as f:
|
||||
version = f.read().strip()
|
||||
|
||||
if version is None or version == "":
|
||||
raise RuntimeError(f"File without version: {version_file}")
|
||||
|
||||
print(f"Version to set: {version}")
|
||||
|
||||
# modify the __init__.py file with @version
|
||||
file1 = os.path.join(os.path.dirname(__file__), "../__init__.py")
|
||||
print(f"> File1: {file1}")
|
||||
|
||||
file1VersionFound = False
|
||||
# lines = None
|
||||
with open(file1, "r") as f:
|
||||
lines = f.readlines()
|
||||
for line in lines:
|
||||
if versionLabel in line:
|
||||
file1VersionFound = True
|
||||
lines[lines.index(line)] = f"{versionLabel} {version}\n"
|
||||
|
||||
if not file1VersionFound:
|
||||
raise RuntimeError(f"Version label not found in file: {file1}")
|
||||
|
||||
with open(file1, "w") as f2:
|
||||
f2.writelines(lines)
|
||||
|
||||
file2 = os.path.join(os.path.dirname(__file__), "../core/version.py")
|
||||
print(f"> File2 {file2}")
|
||||
|
||||
with open(file2, "w") as f2:
|
||||
f2.writelines([f"version = \"{version}\"\n"])
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Crystian
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,601 @@
|
||||
# ComfyUI-Crystools [](https://hits.seeyoufarm.com) [](https://paypal.me/crystian77) <a src="https://colab.research.google.com/assets/colab-badge.svg" href="https://colab.research.google.com/drive/1xiTiPmZkcIqNOsLQPO1UNCdJZqgK3U5k?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a>
|
||||
|
||||
**_🪛 A powerful set of tools for your belt when you work with ComfyUI 🪛_**
|
||||
|
||||
With this suit, you can see the resources monitor, progress bar & time elapsed, metadata and compare between two images, compare between two JSONs, show any value to console/display, pipes, and more!
|
||||
This provides better nodes to load/save images, previews, etc, and see "hidden" data without loading a new workflow.
|
||||
|
||||

|
||||
|
||||
# Table of contents
|
||||
- [General](#general)
|
||||
- [Metadata](#metadata)
|
||||
- [Debugger](#debugger)
|
||||
- [Image](#image)
|
||||
- [Pipe](#pipe)
|
||||
- [Utils](#utils)
|
||||
- [Primitives](#primitives)
|
||||
- [List](#list)
|
||||
- [Switch](#switch)
|
||||
- Others: [About](#about), [To do](#to-do), [Changelog](#changelog), [Installation](#installation), [Use](#use)
|
||||
|
||||
---
|
||||
|
||||
## General
|
||||
|
||||
### Resources monitor
|
||||
|
||||
**🎉Finally, you can see the resources used by ComfyUI (CPU, GPU, RAM, VRAM, and space) on the menu in real-time!**
|
||||
|
||||

|
||||
|
||||
Now you can identify the bottlenecks in your workflow and know when it's time to restart the server, unload models or even close some tabs!
|
||||
|
||||
You can configure the refresh rate which resources to show:
|
||||
|
||||

|
||||
|
||||
> **Notes:**
|
||||
> - The GPU data is only available when you use CUDA (only NVIDIA cards, sorry AMD users).
|
||||
> - This extension needs ComfyUI 1915 (or higher).
|
||||
> - The cost of the monitor is low (0.1 to 0.5% of utilization), you can disable it from settings (`Refres rate` to `0`).
|
||||
> - Data comes from these libraries:
|
||||
> - [psutil](https://pypi.org/project/psutil/)
|
||||
> - [torch](https://pytorch.org/)
|
||||
> - [pynvml](https://pypi.org/project/pynvml/) (official NVIDIA library)
|
||||
|
||||
|
||||
### Progress bar
|
||||
|
||||
You can see the progress of your workflow with a progress bar on the menu!
|
||||
|
||||

|
||||
|
||||
https://github.com/crystian/ComfyUI-Crystools/assets/3886806/35cc1257-2199-4b85-936e-2e31d892959c
|
||||
|
||||
Additionally, it shows the time elapsed at the end of the workflow, and you can `click` on it to see the **current working node.**
|
||||
|
||||
> **Notes:**
|
||||
> - If you don't want to see it, you can turn it off from settings (`Show progress bar in menu`)
|
||||
|
||||
|
||||
## Metadata
|
||||
|
||||
### Node: Metadata extractor
|
||||
|
||||
This node is used to extract the metadata from the image and handle it as a JSON source for other nodes.
|
||||
You can see **all information**, even metadata from other sources (like Photoshop, see sample).
|
||||
|
||||
The input comes from the [load image with metadata](#node-load-image-with-metadata) or [preview from image](#node-preview-from-image) nodes (and others in the future).
|
||||
|
||||

|
||||
|
||||
**Sample:** [metadata-extractor.json](./samples/metadata-extractor.json)
|
||||
|
||||
><details>
|
||||
> <summary>Other metadata sample (photoshop)</summary>
|
||||
>
|
||||
> With metadata from Photoshop
|
||||

|
||||
></details>
|
||||
|
||||
><details>
|
||||
> <summary><i>Parameters</i></summary>
|
||||
>
|
||||
> - input:
|
||||
> - metadata_raw: The metadata raw from the image or preview node
|
||||
> - Output:
|
||||
> - prompt: The prompt used to produce the image.
|
||||
> - workflow: The workflow used to produce the image (all information about nodes, values, etc).
|
||||
> - file info: The file info of the image/metadata (resolution, size, etc) is human readable.
|
||||
> - raw to JSON: The entire metadata is raw but formatted/readable.
|
||||
> - raw to property: The entire metadata is raw in "properties" format.
|
||||
> - raw to csv: The entire metadata is raw in "csv" format.
|
||||
></details>
|
||||
|
||||
<br />
|
||||
|
||||
### Node: Metadata comparator
|
||||
|
||||
This node is so useful for comparing two metadata and seeing the differences (**the main reason why I created this extension!**)
|
||||
|
||||
You can compare 3 inputs: "Prompt", "Workflow" and "Fileinfo"
|
||||
|
||||
There are three potential "outputs": `values_changed`, `dictionary_item_added`, and `dictionary_item_removed` (in this order of priority).
|
||||
|
||||

|
||||
|
||||
**Sample:** [metadata-comparator.json](./samples/metadata-comparator.json)
|
||||
|
||||
**Notes:**
|
||||
- I use [DeepDiff](https://pypi.org/project/deepdiff) for that. For more info check the link.
|
||||
- If you want to compare two JSONs, you can use the [JSON comparator](#node-JSON-comparator) node.
|
||||
|
||||
|
||||
><details>
|
||||
> <summary><i>Parameters</i></summary>
|
||||
>
|
||||
> - options:
|
||||
> - what: What to compare, you can choose between "Prompt", "Workflow" and "Fileinfo"
|
||||
> - input:
|
||||
> - metadata_raw_old: The metadata raw to start comparing
|
||||
> - metadata_raw_new: The metadata raw to compare
|
||||
> - Output:
|
||||
> - diff: This is the same output you can see in the display of the node; you can use it on other nodes.
|
||||
></details>
|
||||
|
||||
<br />
|
||||
|
||||
---
|
||||
|
||||
## Debugger
|
||||
|
||||
### Node: Show Metadata
|
||||
|
||||
With this node, you will be able to see the JSON produced from your entire prompt and workflow so that you can know all the values (and more) of your prompt quickly without opening the file (PNG or JSON).
|
||||
|
||||

|
||||
|
||||
**Sample:** [debugger-metadata.json](./samples/debugger-metadata.json)
|
||||
|
||||
><details>
|
||||
> <summary><i>Parameters</i></summary>
|
||||
>
|
||||
> - Options:
|
||||
> - Active: Enable/disable the node
|
||||
> - Parsed: Show the parsed JSON or plain text
|
||||
> - What: Show the prompt or workflow (prompt are values to produce the image, and workflow is the entire workflow of ComfyUI)
|
||||
></details>
|
||||
|
||||
<br />
|
||||
|
||||
### Node: Show any
|
||||
|
||||
You can see on the console or display any text or data from the nodes. Connect it to what you want to inspect, and you will see it.
|
||||
|
||||

|
||||
|
||||
**Sample:** [debugger-any.json](./samples/debugger-any.json)
|
||||
|
||||
><details>
|
||||
> <summary><i>Parameters</i></summary>
|
||||
>
|
||||
> - Input:
|
||||
> - any_value: Any value to show, which can be a string, number, etc.
|
||||
> - Options:
|
||||
> - Console: Enable/disable write to console
|
||||
> - Display: Enable/disable write on this node
|
||||
> - Prefix: Prefix to console
|
||||
></details>
|
||||
|
||||
<br />
|
||||
|
||||
### Node: Show any to JSON
|
||||
|
||||
It is the same as the previous one, but it formatted the value to JSON (only display).
|
||||
|
||||

|
||||
|
||||
**Sample:** [debugger-json.json](./samples/debugger-json.json)
|
||||
|
||||
><details>
|
||||
> <summary><i>Parameters</i></summary>
|
||||
>
|
||||
> - Input:
|
||||
> - any_value: Any value to try to convert to JSON
|
||||
> - Output:
|
||||
> - string: The same string is shown on the display
|
||||
></details>
|
||||
|
||||
<br />
|
||||
|
||||
---
|
||||
|
||||
## Image
|
||||
|
||||
### Node: Load image with metadata
|
||||
This node is the same as the default one, but it adds three features: Prompt, Metadata, and supports **subfolders** of the "input" folder.
|
||||
|
||||

|
||||
|
||||
**Sample:** [image-load.json](./samples/image-load.json)
|
||||
|
||||
><details>
|
||||
> <summary><i>Parameters</i></summary>
|
||||
>
|
||||
> - Input:
|
||||
> - image: Read the images from the input folder (and subfolder) (you can drop the image here or even paste an image from the clipboard)
|
||||
> - Output:
|
||||
> - Image/Mask: The same as the default node
|
||||
> - Prompt: The prompt used to produce the image (not the workflow)
|
||||
> - Metadata RAW: The metadata raw of the image (full workflow) as string
|
||||
></details>
|
||||
|
||||
**Note:** The subfolders support inspired on: [comfyui-imagesubfolders](https://github.com/catscandrive/comfyui-imagesubfolders)
|
||||
|
||||
<br />
|
||||
|
||||
### Node: Save image with extra metadata
|
||||
This node is the same as the default one, but it adds two features: Save the workflow in the png or not, and you can add any piece of metadata (as JSON).
|
||||
|
||||
This saves custom data on the image, so you can share it with others, and they can see the workflow and metadata (see [preview from metadata](#node-preview-from-metadata)), even your custom data.
|
||||
|
||||
It can be any type of information that supports text and JSON.
|
||||
|
||||

|
||||
|
||||
**Sample:** [image-save.json](./samples/image-save.json)
|
||||
|
||||
><details>
|
||||
> <summary><i>Parameters</i></summary>
|
||||
>
|
||||
> - options:
|
||||
> - with_workflow: If you want to save into the image workflow (special to share the workflow with others)
|
||||
> - Input:
|
||||
> - image: The image to save (same as the default node)
|
||||
> - Output:
|
||||
> - Metadata RAW: The metadata raw of the image (full workflow) as string
|
||||
></details>
|
||||
|
||||
**Note:** The data is saved as special "exif" (as ComfyUI does) in the png file; you can read it with [Load image with metadata](#node-load-image-with-metadata).
|
||||
|
||||
> **Important:**
|
||||
> - If you want to save your workflow with a particular name and your data as creator, you need to use the [ComfyUI-Crystools-save](https://github.com/crystian/ComfyUI-Crystools-save) extension; try it!
|
||||

|
||||
|
||||
|
||||
<br />
|
||||
|
||||
### Node: Preview from image
|
||||
|
||||
This node is used to preview the image with the **current prompt** and additional features.
|
||||
|
||||

|
||||
|
||||
**Feature:** It supports cache (shows as "CACHED") (not permanent yet!), so you can disconnect the node and still see the image and data, so you can use it to compare with others!
|
||||
|
||||

|
||||
|
||||
As you can see the seed, steps, and cfg were changed
|
||||
|
||||
**Sample:** [image-preview-image.json](./samples/image-preview-image.json)
|
||||
|
||||
><details>
|
||||
> <summary><i>Parameters</i></summary>
|
||||
>
|
||||
> - Input:
|
||||
> - image: Any kind of image link
|
||||
> - Output:
|
||||
> - Metadata RAW: The metadata raw of the image and full workflow.
|
||||
> - You can use it to **compare with others** (see [metadata comparator](#node-metadata-comparator))
|
||||
> - The file info like filename, resolution, datetime and size with **the current prompt, not the original one!** (see important note)
|
||||
></details>
|
||||
|
||||
> **Important:**
|
||||
> - If you want to read the metadata of the image, you need to use the [load image with metadata](#node-load-image-with-metadata) and use the output "metadata RAW" not the image link.
|
||||
> - To do a preview, it is necessary to save it first on the temporal folder, and the data shown is from the temporal image, **not the original one** even **the prompt!**
|
||||
|
||||
<br />
|
||||
|
||||
### Node: Preview from metadata
|
||||
|
||||
This node is used to preview the image from the metadata and shows additional data (all around this one).
|
||||
It supports the same features as [preview from image](#node-preview-from-image) (cache, metadata raw, etc.). But the important difference is you see **real data from the image** (not the temporal one or the current prompt).
|
||||
|
||||

|
||||
|
||||
**Sample:** [image-preview-metadata.json](./samples/image-preview-metadata.json)
|
||||
|
||||
<br />
|
||||
|
||||
### Node: Show resolution
|
||||
|
||||
This node is used to show the resolution of an image.
|
||||
|
||||
> Can be used with any image link.
|
||||
|
||||

|
||||
|
||||
**Sample:** [image-resolution.json](./samples/image-resolution.json)
|
||||
|
||||
><details>
|
||||
> <summary><i>Parameters</i></summary>
|
||||
>
|
||||
> - Input:
|
||||
> - image: Any kind of image link
|
||||
> - Output:
|
||||
> - Width: The width of the image
|
||||
> - Height: The height of the image
|
||||
></details>
|
||||
|
||||
<br />
|
||||
|
||||
---
|
||||
|
||||
## Pipe
|
||||
|
||||
### Nodes: Pipe to/edit any, Pipe from any
|
||||
|
||||
This powerful set of nodes is used to better organize your pipes.
|
||||
|
||||
The "Pipe to/edit any" node is used to encapsulate multiple links into a single one. It includes support for editing and easily adding the modified content back to the same pipe number.
|
||||
|
||||
The "Pipe from any" node is used to extract the content of a pipe.
|
||||
|
||||
Typical example:
|
||||
|
||||

|
||||
|
||||
With pipes:
|
||||
|
||||

|
||||
|
||||
**Sample:** [pipe-1.json](./samples/pipe-1.json)
|
||||
|
||||
Editing pipes:
|
||||
|
||||

|
||||
|
||||
**Sample:** [pipe-2.json](./samples/pipe-2.json)
|
||||
|
||||
><details>
|
||||
> <summary><i>Parameters</i></summary>
|
||||
>
|
||||
> - Input:
|
||||
> - CPipeAny: This is the type of this pipe you can use to edit (see the sample)
|
||||
> - any_*: 6 possible inputs to use
|
||||
> - Output:
|
||||
> - CPipeAny: You can continue the pipe with this output; you can use it to bifurcate the pipe (see the sample)
|
||||
></details>
|
||||
|
||||
>**Important:**
|
||||
> - Please note that it supports "any," meaning it does not validate (not yet!) the correspondence of input nodes with the output ones. When creating the link, it is recommended to link consciously number by number.
|
||||
> - "RecursionError" It's crucial to note that the flow of links **must be in the same direction**, and they cannot be mixed with other flows that use the result of this one. Otherwise, this may lead to recursion and block the server (you need to restart it!)
|
||||
|
||||
|
||||
><details>
|
||||
> <summary><i>Bad example with "RecursionError: maximum recursion depth exceeded"</i></summary>
|
||||
>
|
||||
> If you see something like this on your console, you need to check your pipes. That is bad sample of pipes, you can't mix the flows.
|
||||

|
||||
></details>
|
||||
|
||||
<br />
|
||||
|
||||
---
|
||||
|
||||
## Utils
|
||||
|
||||
Some useful nodes to use in your workflow.
|
||||
|
||||
### Node: JSON comparator
|
||||
|
||||
This node is so useful to compare two JSONs and see the differences.
|
||||
|
||||

|
||||
|
||||
**Sample:** [utils-json-comparator.json](./samples/utils-json-comparator.json)
|
||||
|
||||
|
||||
><details>
|
||||
> <summary><i>Parameters</i></summary>
|
||||
>
|
||||
> - input:
|
||||
> - json_old: The first JSON to start compare
|
||||
> - json_new: The JSON to compare
|
||||
> - Output:
|
||||
> - diff: A new JSON with the differences
|
||||
></details>
|
||||
|
||||
|
||||
**Notes:**
|
||||
As you can see, it is the same as the [metadata comparator](#node-metadata-comparator) but with JSONs.
|
||||
The other is intentionally simple to compare two images metadata; this is more generic.
|
||||
The main difference is that you can compare any JSON, not only metadata.
|
||||
|
||||
<br />
|
||||
|
||||
### Node: Stats system
|
||||
|
||||
This node is used to show the system stats (RAM, VRAM, and Space).
|
||||
It **should** connect as a pipe.
|
||||
|
||||

|
||||
|
||||
**Sample:** [utils-stats.json](./samples/utils-stats.json)
|
||||
|
||||
><details>
|
||||
> <summary><i>Parameters</i></summary>
|
||||
>
|
||||
> - input:
|
||||
> - latent: The latent to use to measure the stats
|
||||
> - Output:
|
||||
> - latent: Return the same latent to continue the pipe
|
||||
></details>
|
||||
|
||||
**Notes:** The original is in [WAS](https://github.com/WASasquatch/was-node-suite-comfyui), I only show it on the display.
|
||||
|
||||
<br />
|
||||
|
||||
---
|
||||
|
||||
## Primitives
|
||||
|
||||
### Nodes: Primitive boolean, Primitive integer, Primitive float, Primitive string, Primitive string multiline
|
||||
|
||||
A set of nodes with primitive values to use in your prompts.
|
||||
|
||||

|
||||
|
||||
<br />
|
||||
|
||||
---
|
||||
|
||||
## List
|
||||
A set of nodes with a list of values (any or strings/texts) for any proposal (news nodes to use it coming soon!).
|
||||
|
||||
> **Important:** You can use other nodes like "Show any" to see the values of the list
|
||||
|
||||
### Node: List of strings
|
||||
|
||||
**Feature:** You can concatenate them.
|
||||
|
||||

|
||||
|
||||
**Sample:** [list-strings.json](./samples/list-strings.json)
|
||||
|
||||
><details>
|
||||
> <summary><i>Parameters</i></summary>
|
||||
>
|
||||
> - Input:
|
||||
> - string_*: 8 possible inputs to use
|
||||
> - delimiter: Use to concatenate the values on the output
|
||||
> - Output:
|
||||
> - concatenated: A string with all values concatenated
|
||||
> - list_string: The list of strings (only with values)
|
||||
></details>
|
||||
|
||||
<br />
|
||||
|
||||
### Node: List of any
|
||||
|
||||
You can concatenate any value (it will try to convert it to a string and show the value), so it is util to see several values at the same time.
|
||||
|
||||

|
||||
|
||||
**Sample:** [list-any.json](./samples/list-any.json)
|
||||
|
||||
><details>
|
||||
> <summary><i>Parameters</i></summary>
|
||||
>
|
||||
> - Input:
|
||||
> - any_*: 8 possible inputs to use
|
||||
> - Output:
|
||||
> - list_any: The list of any elements (only with values)
|
||||
></details>
|
||||
|
||||
<br />
|
||||
|
||||
---
|
||||
|
||||
## Switch
|
||||
A set of nodes to switch between flows.
|
||||
|
||||
All switches are boolean; you can switch between flows by simply changing the value of the switch.
|
||||
You have predefined switches (string, latent, image, conditioning) but you can use "Switch any" for any value/type.
|
||||
|
||||

|
||||
|
||||
**Sample:** [switch.json](./samples/switch.json)
|
||||
|
||||
<br />
|
||||
|
||||
---
|
||||
|
||||
## About
|
||||
|
||||
**Notes from the author:**
|
||||
- This is my first project in python ¯\\_(ツ)_/¯ (PR are welcome!)
|
||||
- I'm a software engineer but in other languages (web technologies)
|
||||
- My Instagram is: https://www.instagram.com/crystian.ia I'll publish my works on it, so consider following me for news! :)
|
||||
- I'm not a native English speaker, so sorry for my English :P
|
||||
|
||||
---
|
||||
|
||||
## To do
|
||||
- [ ] Several unit tests
|
||||
- [ ] Add permanent cache for preview/metadata image (to survive to F5! or restart the server)
|
||||
|
||||
---
|
||||
|
||||
## Changelog
|
||||
|
||||
### Crystools
|
||||
|
||||
### 1.10.0 (17/01/2024)
|
||||
- Multi-gpu added
|
||||
|
||||
### 1.9.2 (15/01/2024)
|
||||
- Big refactor on hardwareInfo and monitor.ts, gpu was separated on another file, preparing for multi-gpu support
|
||||
|
||||
### 1.8.0 (14/01/2024) - internal
|
||||
- HDD monitor selector on settings
|
||||
|
||||
### 1.7.0 (11/01/2024) - internal
|
||||
- Typescript added!
|
||||
|
||||
### 1.6.0 (11/01/2024)
|
||||
- Fix issue [#7](https://github.com/crystian/ComfyUI-Crystools/issues/7) to the thread deadlock on concurrency
|
||||
|
||||
### 1.5.0 (10/01/2024)
|
||||
- Improvements on the resources monitor and how handle the threads
|
||||
- Some fixes
|
||||
|
||||
### 1.3.0 (08/01/2024)
|
||||
- Added in general Resources monitor (CPU, GPU, RAM, VRAM, and space)
|
||||
- Added this icon to identify this set of tools: 🪛
|
||||
|
||||
### 1.2.0 (05/01/2024)
|
||||
- progress bar added
|
||||
|
||||
### 1.1.0 (29/12/2023)
|
||||
- Node added: "Save image with extra metadata"
|
||||
- Support to **read** Jpeg metadata added (not save)
|
||||
|
||||
### 1.0.0 (26/12/2023)
|
||||
- First release
|
||||
|
||||
|
||||
### Crystools-save
|
||||
|
||||
### 1.1.0 (07/01/2024)
|
||||
- Labeling updated according to the new version of Crystools (this project)
|
||||
|
||||
### 1.0.0 (29/12/2023)
|
||||
- Created another extension to save the info about the author on workflow: [ComfyUI-Crystools-save](https://github.com/crystian/ComfyUI-Crystools-save)
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
### Install from GitHub
|
||||
1. Install [ComfyUi](https://github.com/comfyanonymous/ComfyUI).
|
||||
2. Clone this repo into `custom_modules`:
|
||||
```
|
||||
cd ComfyUI/custom_nodes
|
||||
git clone https://github.com/crystian/ComfyUI-Crystools.git
|
||||
cd ComfyUI-Crystools
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
3. Start up ComfyUI.
|
||||
|
||||
### Install from manager
|
||||
|
||||
Search for `crystools` in the [manager](https://github.com/ltdrdata/ComfyUI-Manager.git) and install it.
|
||||
|
||||
### Using on Google Colab
|
||||
|
||||
You can use it on Google Colab, but you need to install it manually:
|
||||
|
||||
[Google Colab](https://colab.research.google.com/drive/1xiTiPmZkcIqNOsLQPO1UNCdJZqgK3U5k?usp=sharing)
|
||||
|
||||
* Run the first cell to install ComfyUI and launch the server
|
||||
* After it finishes, use the link to open the a new tab, looking a line like this:
|
||||
```
|
||||
This is the URL to access ComfyUI: https://identifying-complications-fw-some.trycloudflare.com
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Use
|
||||
|
||||
You can use it as any other node, just using the menu in the category `crystools` or double clicking on the canvas (I recommended using the "oo" to fast filter), all nodes were post fixing with `[Crystools]`.
|
||||
|
||||

|
||||

|
||||
|
||||
If for some reason you need to see the logs, you can define the environment variable `CRYSTOOLS_LOGLEVEL` and set the [value](https://docs.python.org/es/3/howto/logging.html).
|
||||
|
||||
---
|
||||
|
||||
Made with ❤️ by Crystian.
|
||||
@@ -0,0 +1,99 @@
|
||||
"""
|
||||
@author: Crystian
|
||||
@title: Crystools
|
||||
@nickname: Crystools
|
||||
@version: 1.11.0
|
||||
@project: "https://github.com/crystian/ComfyUI-Crystools",
|
||||
@description: Plugins for multiples uses, mainly for debugging, you need them! IG: https://www.instagram.com/crystian.ia
|
||||
"""
|
||||
|
||||
from .core import version, logger
|
||||
logger.info(f'Crystools version: {version}')
|
||||
|
||||
from .nodes._names import CLASSES
|
||||
from .nodes.primitive import CBoolean, CText, CTextML, CInteger, CFloat
|
||||
from .nodes.switch import CSwitchBooleanAny, CSwitchBooleanLatent, CSwitchBooleanConditioning, CSwitchBooleanImage, \
|
||||
CSwitchBooleanString, CSwitchBooleanMask
|
||||
from .nodes.debugger import CConsoleAny, CConsoleAnyToJson
|
||||
from .nodes.image import CImagePreviewFromImage, CImageLoadWithMetadata, CImageGetResolution, CImagePreviewFromMetadata, \
|
||||
CImageSaveWithExtraMetadata
|
||||
from .nodes.list import CListAny, CListString
|
||||
from .nodes.pipe import CPipeToAny, CPipeFromAny
|
||||
from .nodes.utils import CUtilsCompareJsons, CUtilsStatSystem
|
||||
from .nodes.metadata import CMetadataExtractor, CMetadataCompare
|
||||
from .server import *
|
||||
from .general import *
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
CLASSES.CBOOLEAN_NAME.value: CBoolean,
|
||||
CLASSES.CTEXT_NAME.value: CText,
|
||||
CLASSES.CTEXTML_NAME.value: CTextML,
|
||||
CLASSES.CINTEGER_NAME.value: CInteger,
|
||||
CLASSES.CFLOAT_NAME.value: CFloat,
|
||||
|
||||
CLASSES.CDEBUGGER_CONSOLE_ANY_NAME.value: CConsoleAny,
|
||||
CLASSES.CDEBUGGER_CONSOLE_ANY_TO_JSON_NAME.value: CConsoleAnyToJson,
|
||||
|
||||
CLASSES.CLIST_ANY_NAME.value: CListAny,
|
||||
CLASSES.CLIST_STRING_NAME.value: CListString,
|
||||
|
||||
CLASSES.CSWITCH_ANY_NAME.value: CSwitchBooleanAny,
|
||||
CLASSES.CSWITCH_LATENT_NAME.value: CSwitchBooleanLatent,
|
||||
CLASSES.CSWITCH_CONDITIONING_NAME.value: CSwitchBooleanConditioning,
|
||||
CLASSES.CSWITCH_IMAGE_NAME.value: CSwitchBooleanImage,
|
||||
CLASSES.CSWITCH_MASK_NAME.value: CSwitchBooleanMask,
|
||||
CLASSES.CSWITCH_STRING_NAME.value: CSwitchBooleanString,
|
||||
|
||||
CLASSES.CPIPE_TO_ANY_NAME.value: CPipeToAny,
|
||||
CLASSES.CPIPE_FROM_ANY_NAME.value: CPipeFromAny,
|
||||
|
||||
CLASSES.CIMAGE_LOAD_METADATA_NAME.value: CImageLoadWithMetadata,
|
||||
CLASSES.CIMAGE_GET_RESOLUTION_NAME.value: CImageGetResolution,
|
||||
CLASSES.CIMAGE_PREVIEW_IMAGE_NAME.value: CImagePreviewFromImage,
|
||||
CLASSES.CIMAGE_PREVIEW_METADATA_NAME.value: CImagePreviewFromMetadata,
|
||||
CLASSES.CIMAGE_SAVE_METADATA_NAME.value: CImageSaveWithExtraMetadata,
|
||||
|
||||
CLASSES.CMETADATA_EXTRACTOR_NAME.value: CMetadataExtractor,
|
||||
CLASSES.CMETADATA_COMPARATOR_NAME.value: CMetadataCompare,
|
||||
CLASSES.CUTILS_JSON_COMPARATOR_NAME.value: CUtilsCompareJsons,
|
||||
CLASSES.CUTILS_STAT_SYSTEM_NAME.value: CUtilsStatSystem
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
CLASSES.CBOOLEAN_NAME.value: CLASSES.CBOOLEAN_DESC.value,
|
||||
CLASSES.CTEXT_NAME.value: CLASSES.CTEXT_DESC.value,
|
||||
CLASSES.CTEXTML_NAME.value: CLASSES.CTEXTML_DESC.value,
|
||||
CLASSES.CINTEGER_NAME.value: CLASSES.CINTEGER_DESC.value,
|
||||
CLASSES.CFLOAT_NAME.value: CLASSES.CFLOAT_DESC.value,
|
||||
|
||||
CLASSES.CDEBUGGER_CONSOLE_ANY_NAME.value: CLASSES.CDEBUGGER_ANY_DESC.value,
|
||||
CLASSES.CDEBUGGER_CONSOLE_ANY_TO_JSON_NAME.value: CLASSES.CDEBUGGER_CONSOLE_ANY_TO_JSON_DESC.value,
|
||||
|
||||
CLASSES.CLIST_ANY_NAME.value: CLASSES.CLIST_ANY_DESC.value,
|
||||
CLASSES.CLIST_STRING_NAME.value: CLASSES.CLIST_STRING_DESC.value,
|
||||
|
||||
CLASSES.CSWITCH_ANY_NAME.value: CLASSES.CSWITCH_ANY_DESC.value,
|
||||
CLASSES.CSWITCH_LATENT_NAME.value: CLASSES.CSWITCH_LATENT_DESC.value,
|
||||
CLASSES.CSWITCH_CONDITIONING_NAME.value: CLASSES.CSWITCH_CONDITIONING_DESC.value,
|
||||
CLASSES.CSWITCH_IMAGE_NAME.value: CLASSES.CSWITCH_IMAGE_DESC.value,
|
||||
CLASSES.CSWITCH_MASK_NAME.value: CLASSES.CSWITCH_MASK_DESC.value,
|
||||
CLASSES.CSWITCH_STRING_NAME.value: CLASSES.CSWITCH_STRING_DESC.value,
|
||||
|
||||
CLASSES.CPIPE_TO_ANY_NAME.value: CLASSES.CPIPE_TO_ANY_DESC.value,
|
||||
CLASSES.CPIPE_FROM_ANY_NAME.value: CLASSES.CPIPE_FROM_ANY_DESC.value,
|
||||
|
||||
CLASSES.CIMAGE_LOAD_METADATA_NAME.value: CLASSES.CIMAGE_LOAD_METADATA_DESC.value,
|
||||
CLASSES.CIMAGE_GET_RESOLUTION_NAME.value: CLASSES.CIMAGE_GET_RESOLUTION_DESC.value,
|
||||
CLASSES.CIMAGE_PREVIEW_IMAGE_NAME.value: CLASSES.CIMAGE_PREVIEW_IMAGE_DESC.value,
|
||||
CLASSES.CIMAGE_PREVIEW_METADATA_NAME.value: CLASSES.CIMAGE_PREVIEW_METADATA_DESC.value,
|
||||
CLASSES.CIMAGE_SAVE_METADATA_NAME.value: CLASSES.CIMAGE_SAVE_METADATA_DESC.value,
|
||||
|
||||
CLASSES.CMETADATA_EXTRACTOR_NAME.value: CLASSES.CMETADATA_EXTRACTOR_DESC.value,
|
||||
CLASSES.CMETADATA_COMPARATOR_NAME.value: CLASSES.CMETADATA_COMPARATOR_DESC.value,
|
||||
|
||||
CLASSES.CUTILS_JSON_COMPARATOR_NAME.value: CLASSES.CUTILS_JSON_COMPARATOR_DESC.value,
|
||||
CLASSES.CUTILS_STAT_SYSTEM_NAME.value: CLASSES.CUTILS_STAT_SYSTEM_DESC.value,
|
||||
}
|
||||
|
||||
|
||||
WEB_DIRECTORY = "./web"
|
||||
@@ -0,0 +1,6 @@
|
||||
from .logger import *
|
||||
from .keys import *
|
||||
from .types import *
|
||||
from .config import *
|
||||
from .common import *
|
||||
from .version import *
|
||||
@@ -0,0 +1,107 @@
|
||||
import os
|
||||
import json
|
||||
import torch
|
||||
from deepdiff import DeepDiff
|
||||
from ..core import CONFIG, logger
|
||||
|
||||
|
||||
# just a helper function to set the widget values (or clear them)
|
||||
def setWidgetValues(value=None, unique_id=None, extra_pnginfo=None) -> None:
|
||||
if unique_id and extra_pnginfo:
|
||||
workflow = extra_pnginfo["workflow"]
|
||||
node = next((x for x in workflow["nodes"] if str(x["id"]) == unique_id), None)
|
||||
|
||||
if node:
|
||||
node["widgets_values"] = value
|
||||
|
||||
return None
|
||||
|
||||
|
||||
# find difference between two jsons
|
||||
def findJsonStrDiff(json1, json2):
|
||||
msgError = "Could not compare jsons"
|
||||
returnJson = {"error": msgError}
|
||||
try:
|
||||
# TODO review this
|
||||
# dict1 = json.loads(json1)
|
||||
# dict2 = json.loads(json2)
|
||||
|
||||
returnJson = findJsonsDiff(json1, json2)
|
||||
|
||||
returnJson = json.dumps(returnJson, indent=CONFIG["indent"])
|
||||
except Exception as e:
|
||||
logger.warn(f"{msgError}: {e}")
|
||||
|
||||
return returnJson
|
||||
|
||||
|
||||
def findJsonsDiff(json1, json2):
|
||||
msgError = "Could not compare jsons"
|
||||
returnJson = {"error": msgError}
|
||||
|
||||
try:
|
||||
diff = DeepDiff(json1, json2, ignore_order=True, verbose_level=2)
|
||||
|
||||
returnJson = {k: v for k, v in diff.items() if
|
||||
k in ('dictionary_item_added', 'dictionary_item_removed', 'values_changed')}
|
||||
|
||||
# just for print "values_changed" at first
|
||||
returnJson = dict(reversed(returnJson.items()))
|
||||
|
||||
except Exception as e:
|
||||
logger.warn(f"{msgError}: {e}")
|
||||
|
||||
return returnJson
|
||||
|
||||
|
||||
# powered by:
|
||||
# https://github.com/WASasquatch/was-node-suite-comfyui/blob/main/WAS_Node_Suite.py
|
||||
# class: WAS_Samples_Passthrough_Stat_System
|
||||
def get_system_stats():
|
||||
import psutil
|
||||
|
||||
# RAM
|
||||
ram = psutil.virtual_memory()
|
||||
ram_used = ram.used / (1024 ** 3)
|
||||
ram_total = ram.total / (1024 ** 3)
|
||||
ram_stats = f"Used RAM: {ram_used:.2f} GB / Total RAM: {ram_total:.2f} GB"
|
||||
|
||||
# VRAM (with PyTorch)
|
||||
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
||||
vram_used = torch.cuda.memory_allocated(device) / (1024 ** 3)
|
||||
vram_total = torch.cuda.get_device_properties(device).total_memory / (1024 ** 3)
|
||||
vram_stats = f"Used VRAM: {vram_used:.2f} GB / Total VRAM: {vram_total:.2f} GB"
|
||||
|
||||
# Hard Drive Space
|
||||
hard_drive = psutil.disk_usage("/")
|
||||
used_space = hard_drive.used / (1024 ** 3)
|
||||
total_space = hard_drive.total / (1024 ** 3)
|
||||
hard_drive_stats = f"Used Space: {used_space:.2f} GB / Total Space: {total_space:.2f} GB"
|
||||
|
||||
return [ram_stats, vram_stats, hard_drive_stats]
|
||||
|
||||
|
||||
# return x and y resolution of an image (torch tensor)
|
||||
def getResolutionByTensor(image=None) -> dict:
|
||||
res = {"x": 0, "y": 0}
|
||||
|
||||
if image is not None:
|
||||
img = image.movedim(-1, 1)
|
||||
|
||||
res["x"] = img.shape[3]
|
||||
res["y"] = img.shape[2]
|
||||
|
||||
return res
|
||||
|
||||
|
||||
# by https://stackoverflow.com/questions/6080477/how-to-get-the-size-of-tar-gz-in-mb-file-in-python
|
||||
def get_size(path):
|
||||
size = os.path.getsize(path)
|
||||
if size < 1024:
|
||||
return f"{size} bytes"
|
||||
elif size < pow(1024, 2):
|
||||
return f"{round(size / 1024, 2)} KB"
|
||||
elif size < pow(1024, 3):
|
||||
return f"{round(size / (pow(1024, 2)), 2)} MB"
|
||||
elif size < pow(1024, 4):
|
||||
return f"{round(size / (pow(1024, 3)), 2)} GB"
|
||||
@@ -0,0 +1,7 @@
|
||||
import os
|
||||
import logging
|
||||
|
||||
CONFIG = {
|
||||
"loglevel": int(os.environ.get("CRYSTOOLS_LOGLEVEL", logging.INFO)),
|
||||
"indent": int(os.environ.get("CRYSTOOLS_INDENT", 2))
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class TEXTS(Enum):
|
||||
CUSTOM_NODE_NAME = "Crystools"
|
||||
LOGGER_PREFIX = "Crystools"
|
||||
CONCAT = "concatenated"
|
||||
INACTIVE_MSG = "inactive"
|
||||
INVALID_METADATA_MSG = "Invalid metadata raw"
|
||||
FILE_NOT_FOUND = "File not found!"
|
||||
|
||||
|
||||
class CATEGORY(Enum):
|
||||
TESTING = "_for_testing"
|
||||
MAIN = "crystools 🪛"
|
||||
PRIMITIVE = "/Primitive"
|
||||
DEBUGGER = "/Debugger"
|
||||
LIST = "/List"
|
||||
SWITCH = "/Switch"
|
||||
PIPE = "/Pipe"
|
||||
IMAGE = "/Image"
|
||||
UTILS = "/Utils"
|
||||
METADATA = "/Metadata"
|
||||
|
||||
|
||||
# remember, all keys should be in lowercase!
|
||||
class KEYS(Enum):
|
||||
LIST = "list_string"
|
||||
PREFIX = "prefix"
|
||||
@@ -0,0 +1,39 @@
|
||||
# by https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet/blob/main/control/logger.py
|
||||
import sys
|
||||
import copy
|
||||
import logging
|
||||
from .keys import TEXTS
|
||||
from .config import CONFIG
|
||||
|
||||
|
||||
class ColoredFormatter(logging.Formatter):
|
||||
COLORS = {
|
||||
"DEBUG": "\033[0;36m", # CYAN
|
||||
"INFO": "\033[0;32m", # GREEN
|
||||
"WARNING": "\033[0;33m", # YELLOW
|
||||
"ERROR": "\033[0;31m", # RED
|
||||
"CRITICAL": "\033[0;37;41m", # WHITE ON RED
|
||||
"RESET": "\033[0m", # RESET COLOR
|
||||
}
|
||||
|
||||
def format(self, record):
|
||||
colored_record = copy.copy(record)
|
||||
levelname = colored_record.levelname
|
||||
seq = self.COLORS.get(levelname, self.COLORS["RESET"])
|
||||
colored_record.levelname = f"{seq}{levelname}{self.COLORS['RESET']}"
|
||||
return super().format(colored_record)
|
||||
|
||||
|
||||
# Create a new logger
|
||||
logger = logging.getLogger(TEXTS.LOGGER_PREFIX.value)
|
||||
logger.propagate = False
|
||||
|
||||
# Add handler if we don't have one.
|
||||
if not logger.handlers:
|
||||
handler = logging.StreamHandler(sys.stdout)
|
||||
handler.setFormatter(ColoredFormatter("[%(name)s %(levelname)s] %(message)s"))
|
||||
logger.addHandler(handler)
|
||||
|
||||
# Configure logger
|
||||
loglevel = CONFIG["loglevel"]
|
||||
logger.setLevel(loglevel)
|
||||
@@ -0,0 +1,36 @@
|
||||
import sys
|
||||
|
||||
FLOAT = ("FLOAT", {"default": 1,
|
||||
"min": -sys.float_info.max,
|
||||
"max": sys.float_info.max,
|
||||
"step": 0.01})
|
||||
|
||||
BOOLEAN = ("BOOLEAN", {"default": True})
|
||||
BOOLEAN_FALSE = ("BOOLEAN", {"default": False})
|
||||
|
||||
INT = ("INT", {"default": 1,
|
||||
"min": -sys.maxsize,
|
||||
"max": sys.maxsize,
|
||||
"step": 1})
|
||||
|
||||
STRING = ("STRING", {"default": ""})
|
||||
|
||||
STRING_ML = ("STRING", {"multiline": True, "default": ""})
|
||||
|
||||
STRING_WIDGET = ("STRING", {"forceInput": True})
|
||||
|
||||
JSON_WIDGET = ("JSON", {"forceInput": True})
|
||||
|
||||
METADATA_RAW = ("METADATA_RAW", {"forceInput": True})
|
||||
|
||||
class AnyType(str):
|
||||
"""A special class that is always equal in not equal comparisons. Credit to pythongosssss"""
|
||||
|
||||
def __eq__(self, _) -> bool:
|
||||
return True
|
||||
|
||||
def __ne__(self, __value: object) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
any = AnyType("*")
|
||||
@@ -0,0 +1 @@
|
||||
version = "1.11.0"
|
||||
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 167 KiB |
|
After Width: | Height: | Size: 205 KiB |
|
After Width: | Height: | Size: 263 KiB |
|
After Width: | Height: | Size: 178 KiB |
|
After Width: | Height: | Size: 273 KiB |
|
After Width: | Height: | Size: 264 KiB |
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 164 KiB |
|
After Width: | Height: | Size: 208 KiB |
|
After Width: | Height: | Size: 149 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 154 KiB |
|
After Width: | Height: | Size: 149 KiB |
|
After Width: | Height: | Size: 177 KiB |
|
After Width: | Height: | Size: 256 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 299 KiB |
|
After Width: | Height: | Size: 284 KiB |
|
After Width: | Height: | Size: 343 KiB |
|
After Width: | Height: | Size: 187 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 190 KiB |
@@ -0,0 +1,3 @@
|
||||
from .monitor import *
|
||||
from .hdd import *
|
||||
from .gpu import *
|
||||
@@ -0,0 +1,143 @@
|
||||
import torch
|
||||
import pynvml
|
||||
import comfy.model_management
|
||||
|
||||
from ..core import logger
|
||||
|
||||
|
||||
class CGPUInfo:
|
||||
"""
|
||||
This class is responsible for getting information from GPU (ONLY).
|
||||
"""
|
||||
cuda = False
|
||||
pynvmlLoaded = False
|
||||
cudaAvailable = False
|
||||
torchDevice = 'cpu'
|
||||
cudaDevice = 'cpu'
|
||||
cudaDevicesFound = 0
|
||||
switchGPU = True
|
||||
switchVRAM = True
|
||||
gpus = []
|
||||
gpusUtilization = []
|
||||
gpusVRAM = []
|
||||
|
||||
def __init__(self):
|
||||
try:
|
||||
pynvml.nvmlInit()
|
||||
self.pynvmlLoaded = True
|
||||
except Exception as e:
|
||||
self.pynvmlLoaded = False
|
||||
logger.error('Could not init pynvml.' + str(e))
|
||||
|
||||
if self.pynvmlLoaded and pynvml.nvmlDeviceGetCount() > 0:
|
||||
self.cudaDevicesFound = pynvml.nvmlDeviceGetCount()
|
||||
|
||||
logger.info(f"GPU/s:")
|
||||
|
||||
# for simulate multiple GPUs (for testing) interchange these comments:
|
||||
# for deviceIndex in range(3):
|
||||
# deviceHandle = pynvml.nvmlDeviceGetHandleByIndex(0)
|
||||
for deviceIndex in range(self.cudaDevicesFound):
|
||||
deviceHandle = pynvml.nvmlDeviceGetHandleByIndex(deviceIndex)
|
||||
|
||||
gpuName = pynvml.nvmlDeviceGetName(deviceHandle)
|
||||
|
||||
logger.info(f"{deviceIndex}) {gpuName}")
|
||||
|
||||
self.gpus.append({
|
||||
'index': deviceIndex,
|
||||
'name': gpuName,
|
||||
})
|
||||
|
||||
# same index as gpus, with default values
|
||||
self.gpusUtilization.append(True)
|
||||
self.gpusVRAM.append(True)
|
||||
|
||||
self.cuda = True
|
||||
logger.info(f'NVIDIA Driver: {pynvml.nvmlSystemGetDriverVersion()}')
|
||||
else:
|
||||
logger.warn('No GPU with CUDA detected.')
|
||||
|
||||
try:
|
||||
self.torchDevice = comfy.model_management.get_torch_device_name(comfy.model_management.get_torch_device())
|
||||
except Exception as e:
|
||||
logger.error('Could not pick default device.' + str(e))
|
||||
|
||||
self.cudaDevice = 'cpu' if self.torchDevice == 'cpu' else 'cuda'
|
||||
self.cudaAvailable = torch.cuda.is_available()
|
||||
|
||||
if self.cuda and self.cudaAvailable and self.torchDevice == 'cpu':
|
||||
logger.warn('CUDA is available, but torch is using CPU.')
|
||||
|
||||
def getInfo(self):
|
||||
logger.debug('Getting GPUs info...')
|
||||
return self.gpus
|
||||
|
||||
def getStatus(self):
|
||||
# logger.debug('CGPUInfo getStatus')
|
||||
gpuUtilization = -1
|
||||
vramUsed = -1
|
||||
vramTotal = -1
|
||||
vramPercent = -1
|
||||
|
||||
gpuType = ''
|
||||
gpus = []
|
||||
|
||||
if self.cudaDevice == 'cpu':
|
||||
gpuType = 'cpu'
|
||||
gpus.append({
|
||||
'gpu_utilization': 0,
|
||||
'vram_total': 0,
|
||||
'vram_used': 0,
|
||||
'vram_used_percent': 0,
|
||||
})
|
||||
else:
|
||||
gpuType = self.cudaDevice
|
||||
|
||||
if self.pynvmlLoaded and self.cuda and self.cudaAvailable:
|
||||
|
||||
# for simulate multiple GPUs (for testing) interchange these comments:
|
||||
# for deviceIndex in range(3):
|
||||
# deviceHandle = pynvml.nvmlDeviceGetHandleByIndex(0)
|
||||
for deviceIndex in range(self.cudaDevicesFound):
|
||||
deviceHandle = pynvml.nvmlDeviceGetHandleByIndex(deviceIndex)
|
||||
|
||||
# GPU Utilization
|
||||
if self.switchGPU and self.gpusUtilization[deviceIndex]:
|
||||
gpuUtilization = 0
|
||||
try:
|
||||
utilization = pynvml.nvmlDeviceGetUtilizationRates(deviceHandle)
|
||||
gpuUtilization = utilization.gpu
|
||||
except Exception as e:
|
||||
if str(e) == "Unknown Error":
|
||||
logger.error('For some reason, pynvml is not working in a laptop with only battery, try to connect and turn on the monitor')
|
||||
else:
|
||||
logger.error('Could not get GPU utilization.' + str(e))
|
||||
|
||||
logger.error('Monitor of GPU is turning off (not on UI!)')
|
||||
self.switchGPU = False
|
||||
|
||||
# VRAM
|
||||
if self.switchVRAM and self.gpusVRAM[deviceIndex]:
|
||||
# Torch or pynvml?, pynvml is more accurate with the system, torch is more accurate with comfyUI
|
||||
memory = pynvml.nvmlDeviceGetMemoryInfo(deviceHandle)
|
||||
vramUsed = memory.used
|
||||
vramTotal = memory.total
|
||||
|
||||
# device = torch.device(gpuType)
|
||||
# vramUsed = torch.cuda.memory_allocated(device)
|
||||
# vramTotal = torch.cuda.get_device_properties(device).total_memory
|
||||
|
||||
vramPercent = vramUsed / vramTotal * 100
|
||||
|
||||
gpus.append({
|
||||
'gpu_utilization': gpuUtilization,
|
||||
'vram_total': vramTotal,
|
||||
'vram_used': vramUsed,
|
||||
'vram_used_percent': vramPercent,
|
||||
})
|
||||
|
||||
return {
|
||||
'device_type': gpuType,
|
||||
'gpus': gpus,
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
import platform
|
||||
import cpuinfo
|
||||
import psutil
|
||||
from .gpu import CGPUInfo
|
||||
from .hdd import getDrivesInfo
|
||||
|
||||
from ..core import logger
|
||||
|
||||
|
||||
class CHardwareInfo:
|
||||
"""
|
||||
This is only class to get information from hardware.
|
||||
Specially for share it to other software.
|
||||
"""
|
||||
switchCPU = False
|
||||
switchHDD = False
|
||||
switchRAM = False
|
||||
whichHDD = '/' # breaks linux
|
||||
|
||||
@property
|
||||
def switchGPU(self):
|
||||
return self.GPUInfo.switchGPU
|
||||
@switchGPU.setter
|
||||
def switchGPU(self, value):
|
||||
self.GPUInfo.switchGPU = value
|
||||
|
||||
@property
|
||||
def switchVRAM(self):
|
||||
return self.GPUInfo.switchVRAM
|
||||
@switchVRAM.setter
|
||||
def switchVRAM(self, value):
|
||||
self.GPUInfo.switchVRAM = value
|
||||
|
||||
def __init__(self, switchCPU=False, switchGPU=False, switchHDD=False, switchRAM=False, switchVRAM=False):
|
||||
self.switchCPU = switchCPU
|
||||
self.switchHDD = switchHDD
|
||||
self.switchRAM = switchRAM
|
||||
|
||||
specName = 'CPU: ' + cpuinfo.get_cpu_info().get('brand_raw', "Unknown")
|
||||
specArch = 'Arch: ' + cpuinfo.get_cpu_info().get('arch_string_raw', "Unknown")
|
||||
specOs = 'OS: ' + str(platform.system()) + ' ' + str(platform.release())
|
||||
logger.info(f"{specName} - {specArch} - {specOs}")
|
||||
|
||||
self.GPUInfo = CGPUInfo()
|
||||
self.switchGPU = switchGPU
|
||||
self.switchVRAM = switchVRAM
|
||||
|
||||
def getHDDsInfo(self):
|
||||
return getDrivesInfo()
|
||||
|
||||
def getGPUInfo(self):
|
||||
return self.GPUInfo.getInfo()
|
||||
|
||||
def getStatus(self):
|
||||
cpu = -1
|
||||
ramTotal = -1
|
||||
ramUsed = -1
|
||||
ramUsedPercent = -1
|
||||
hddTotal = -1
|
||||
hddUsed = -1
|
||||
hddUsedPercent = -1
|
||||
|
||||
if self.switchCPU:
|
||||
cpu = psutil.cpu_percent()
|
||||
|
||||
if self.switchRAM:
|
||||
ram = psutil.virtual_memory()
|
||||
ramTotal = ram.total
|
||||
ramUsed = ram.used
|
||||
ramUsedPercent = ram.percent
|
||||
|
||||
if self.switchHDD:
|
||||
hdd = psutil.disk_usage(self.whichHDD)
|
||||
hddTotal = hdd.total
|
||||
hddUsed = hdd.used
|
||||
hddUsedPercent = hdd.percent
|
||||
|
||||
getStatus = self.GPUInfo.getStatus()
|
||||
|
||||
return {
|
||||
'cpu_utilization': cpu,
|
||||
'ram_total': ramTotal,
|
||||
'ram_used': ramUsed,
|
||||
'ram_used_percent': ramUsedPercent,
|
||||
'hdd_total': hddTotal,
|
||||
'hdd_used': hddUsed,
|
||||
'hdd_used_percent': hddUsedPercent,
|
||||
'device_type': getStatus['device_type'],
|
||||
'gpus': getStatus['gpus'],
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import psutil
|
||||
from ..core import logger
|
||||
|
||||
def getDrivesInfo():
|
||||
hdds = []
|
||||
logger.debug('Getting HDDs info...')
|
||||
for partition in psutil.disk_partitions():
|
||||
hdds.append(partition.mountpoint)
|
||||
|
||||
return hdds
|
||||
@@ -0,0 +1,67 @@
|
||||
import asyncio
|
||||
import server
|
||||
import time
|
||||
import threading
|
||||
from .hardware import CHardwareInfo
|
||||
|
||||
from ..core import logger
|
||||
|
||||
lock = threading.Lock()
|
||||
|
||||
|
||||
class CMonitor:
|
||||
monitorThread = None
|
||||
threadController = threading.Event()
|
||||
rate = 0
|
||||
hardwareInfo = None
|
||||
|
||||
def __init__(self, rate=5, switchCPU=False, switchGPU=False, switchHDD=False, switchRAM=False, switchVRAM=False):
|
||||
self.rate = rate
|
||||
self.hardwareInfo = CHardwareInfo(switchCPU, switchGPU, switchHDD, switchRAM, switchVRAM)
|
||||
|
||||
self.startMonitor()
|
||||
|
||||
async def send_message(self, data) -> None:
|
||||
# I'm not sure if it is ok, but works ¯\_(ツ)_/¯
|
||||
# I tried to use async with send_json, but eventually that don't send the message
|
||||
server.PromptServer.instance.send_sync('crystools.monitor', data)
|
||||
|
||||
def startMonitorLoop(self):
|
||||
# logger.debug('Starting monitor loop...')
|
||||
asyncio.run(self.MonitorLoop())
|
||||
|
||||
async def MonitorLoop(self):
|
||||
while self.rate > 0 and not self.threadController.is_set():
|
||||
data = self.hardwareInfo.getStatus()
|
||||
# logger.debug('data to send' + str(data))
|
||||
await self.send_message(data)
|
||||
await asyncio.sleep(self.rate)
|
||||
|
||||
def startMonitor(self):
|
||||
if self.monitorThread is not None:
|
||||
self.stopMonitor()
|
||||
logger.debug('Restarting monitor...')
|
||||
else:
|
||||
if self.rate == 0:
|
||||
logger.debug('Monitor rate is 0, not starting monitor.')
|
||||
return None
|
||||
|
||||
logger.debug('Starting monitor...')
|
||||
|
||||
self.threadController.clear()
|
||||
|
||||
if self.monitorThread is None or not self.monitorThread.is_alive():
|
||||
lock.acquire()
|
||||
self.monitorThread = threading.Thread(target=self.startMonitorLoop)
|
||||
lock.release()
|
||||
self.monitorThread.daemon = True
|
||||
self.monitorThread.start()
|
||||
|
||||
|
||||
def stopMonitor(self):
|
||||
logger.debug('Stopping monitor...')
|
||||
self.threadController.set()
|
||||
|
||||
|
||||
cmonitor = CMonitor(1, True, True, True, True, True)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
# intentionally left blank
|
||||
@@ -0,0 +1,69 @@
|
||||
from enum import Enum
|
||||
|
||||
prefix = '🪛 '
|
||||
|
||||
# IMPORTANT DON'T CHANGE THE 'NAME' AND 'TYPE' OF THE ENUMS, IT WILL BREAK THE COMPATIBILITY!
|
||||
# remember: NAME is for search, DESC is for contextual
|
||||
class CLASSES(Enum):
|
||||
CBOOLEAN_NAME = 'Primitive boolean [Crystools]'
|
||||
CBOOLEAN_DESC = prefix + 'Primitive boolean'
|
||||
CTEXT_NAME = 'Primitive string [Crystools]'
|
||||
CTEXT_DESC = prefix + 'Primitive string'
|
||||
CTEXTML_NAME = 'Primitive string multiline [Crystools]'
|
||||
CTEXTML_DESC = prefix + 'Primitive string multiline'
|
||||
CINTEGER_NAME = 'Primitive integer [Crystools]'
|
||||
CINTEGER_DESC = prefix + 'Primitive integer'
|
||||
CFLOAT_NAME = 'Primitive float [Crystools]'
|
||||
CFLOAT_DESC = prefix + 'Primitive float'
|
||||
|
||||
CDEBUGGER_CONSOLE_ANY_NAME = 'Show any [Crystools]'
|
||||
CDEBUGGER_ANY_DESC = prefix + 'Show any value to console/display'
|
||||
CDEBUGGER_CONSOLE_ANY_TO_JSON_NAME = 'Show any to JSON [Crystools]'
|
||||
CDEBUGGER_CONSOLE_ANY_TO_JSON_DESC = prefix + 'Show any to JSON'
|
||||
|
||||
CLIST_ANY_TYPE = 'ListAny'
|
||||
CLIST_ANY_NAME = 'List of any [Crystools]'
|
||||
CLIST_ANY_DESC = prefix + 'List of any'
|
||||
CLIST_STRING_TYPE = 'ListString'
|
||||
CLIST_STRING_NAME = 'List of strings [Crystools]'
|
||||
CLIST_STRING_DESC = prefix + 'List of strings'
|
||||
|
||||
CSWITCH_ANY_NAME = 'Switch any [Crystools]'
|
||||
CSWITCH_ANY_DESC = prefix + 'Switch any'
|
||||
CSWITCH_STRING_NAME = 'Switch string [Crystools]'
|
||||
CSWITCH_STRING_DESC = prefix + 'Switch string'
|
||||
CSWITCH_CONDITIONING_NAME = 'Switch conditioning [Crystools]'
|
||||
CSWITCH_CONDITIONING_DESC = prefix + 'Switch conditioning'
|
||||
CSWITCH_IMAGE_NAME = 'Switch image [Crystools]'
|
||||
CSWITCH_IMAGE_DESC = prefix + 'Switch image'
|
||||
CSWITCH_MASK_NAME = 'Switch mask [Crystools]'
|
||||
CSWITCH_MASK_DESC = prefix + 'Switch mask'
|
||||
CSWITCH_LATENT_NAME = 'Switch latent [Crystools]'
|
||||
CSWITCH_LATENT_DESC = prefix + 'Switch latent'
|
||||
|
||||
CPIPE_ANY_TYPE = 'CPipeAny'
|
||||
CPIPE_TO_ANY_NAME = 'Pipe to/edit any [Crystools]'
|
||||
CPIPE_TO_ANY_DESC = prefix + 'Pipe to/edit any'
|
||||
CPIPE_FROM_ANY_NAME = 'Pipe from any [Crystools]'
|
||||
CPIPE_FROM_ANY_DESC = prefix + 'Pipe from any'
|
||||
|
||||
CIMAGE_LOAD_METADATA_NAME = 'Load image with metadata [Crystools]'
|
||||
CIMAGE_LOAD_METADATA_DESC = prefix + 'Load image with metadata'
|
||||
CIMAGE_GET_RESOLUTION_NAME = 'Get resolution [Crystools]'
|
||||
CIMAGE_GET_RESOLUTION_DESC = prefix + 'Get resolution'
|
||||
CIMAGE_PREVIEW_IMAGE_NAME = 'Preview from image [Crystools]'
|
||||
CIMAGE_PREVIEW_IMAGE_DESC = prefix + 'Preview from image'
|
||||
CIMAGE_PREVIEW_METADATA_NAME = 'Preview from metadata [Crystools]'
|
||||
CIMAGE_PREVIEW_METADATA_DESC = prefix + 'Preview from metadata'
|
||||
CIMAGE_SAVE_METADATA_NAME = 'Save image with extra metadata [Crystools]'
|
||||
CIMAGE_SAVE_METADATA_DESC = prefix + 'Save image with extra metadata'
|
||||
|
||||
CMETADATA_EXTRACTOR_NAME = 'Metadata extractor [Crystools]'
|
||||
CMETADATA_EXTRACTOR_DESC = prefix + 'Metadata extractor'
|
||||
CMETADATA_COMPARATOR_NAME = 'Metadata comparator [Crystools]'
|
||||
CMETADATA_COMPARATOR_DESC = prefix + 'Metadata comparator'
|
||||
|
||||
CUTILS_JSON_COMPARATOR_NAME = 'Json comparator [Crystools]'
|
||||
CUTILS_JSON_COMPARATOR_DESC = prefix + 'Json comparator'
|
||||
CUTILS_STAT_SYSTEM_NAME = 'Stats system [Crystools]'
|
||||
CUTILS_STAT_SYSTEM_DESC = prefix + 'Stats system (powered by WAS)'
|
||||
@@ -0,0 +1,123 @@
|
||||
import json
|
||||
from ..core import CONFIG, CATEGORY, BOOLEAN, BOOLEAN_FALSE, KEYS, TEXTS, STRING, logger, any
|
||||
|
||||
class CConsoleAny:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
},
|
||||
"optional": {
|
||||
"any_value": (any,),
|
||||
"console": BOOLEAN_FALSE,
|
||||
"display": BOOLEAN,
|
||||
KEYS.PREFIX.value: STRING,
|
||||
},
|
||||
"hidden": {
|
||||
# "unique_id": "UNIQUE_ID",
|
||||
# "extra_pnginfo": "EXTRA_PNGINFO",
|
||||
},
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.DEBUGGER.value
|
||||
INPUT_IS_LIST = True
|
||||
|
||||
RETURN_TYPES = ()
|
||||
OUTPUT_NODE = True
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, any_value=None, console=False, display=True, prefix=None):
|
||||
console = console[0]
|
||||
display = display[0]
|
||||
prefix = prefix[0]
|
||||
text = ""
|
||||
textToDisplay = TEXTS.INACTIVE_MSG.value
|
||||
|
||||
if any_value is not None:
|
||||
try:
|
||||
if type(any_value) == list:
|
||||
for item in any_value:
|
||||
try:
|
||||
text += str(item)
|
||||
except Exception as e:
|
||||
text += "source exists, but could not be serialized.\n"
|
||||
logger.warn(e)
|
||||
else:
|
||||
logger.warn("any_value is not a list")
|
||||
|
||||
except Exception:
|
||||
try:
|
||||
text = json.dumps(any_value)[1:-1]
|
||||
except Exception:
|
||||
text = 'source exists, but could not be serialized.'
|
||||
|
||||
logger.debug(f"Show any to console is running...")
|
||||
|
||||
if console:
|
||||
if prefix is not None and prefix != "":
|
||||
print(f"{prefix}: {text}")
|
||||
else:
|
||||
print(text)
|
||||
|
||||
if display:
|
||||
textToDisplay = text
|
||||
|
||||
value = [console, display, prefix, textToDisplay]
|
||||
# setWidgetValues(value, unique_id, extra_pnginfo)
|
||||
|
||||
return {"ui": {"text": value}}
|
||||
|
||||
|
||||
class CConsoleAnyToJson:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
},
|
||||
"optional": {
|
||||
"any_value": (any,),
|
||||
},
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.DEBUGGER.value
|
||||
INPUT_IS_LIST = True
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("string",)
|
||||
OUTPUT_NODE = True
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, any_value=None):
|
||||
text = TEXTS.INACTIVE_MSG.value
|
||||
|
||||
if any_value is not None and isinstance(any_value, list):
|
||||
item = any_value[0]
|
||||
|
||||
if isinstance(item, dict):
|
||||
try:
|
||||
text = json.dumps(item, indent=CONFIG["indent"])
|
||||
except Exception as e:
|
||||
text = "The input is a dict, but could not be serialized.\n"
|
||||
logger.warn(e)
|
||||
|
||||
elif isinstance(item, list):
|
||||
try:
|
||||
text = json.dumps(item, indent=CONFIG["indent"])
|
||||
except Exception as e:
|
||||
text = "The input is a list, but could not be serialized.\n"
|
||||
logger.warn(e)
|
||||
|
||||
else:
|
||||
text = str(item)
|
||||
|
||||
logger.debug(f"Show any-json to console is running...")
|
||||
|
||||
return {"ui": {"text": [text]}, "result": (text,)}
|
||||
@@ -0,0 +1,473 @@
|
||||
import os
|
||||
import random
|
||||
import sys
|
||||
import json
|
||||
import hashlib
|
||||
from datetime import datetime
|
||||
import torch
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
from PIL import Image, ImageOps
|
||||
from PIL.ExifTags import TAGS, GPSTAGS, IFD
|
||||
from PIL.PngImagePlugin import PngImageFile
|
||||
from PIL.JpegImagePlugin import JpegImageFile
|
||||
from nodes import PreviewImage, SaveImage
|
||||
import folder_paths
|
||||
|
||||
from ..core import CATEGORY, CONFIG, BOOLEAN, METADATA_RAW,TEXTS, setWidgetValues, logger, getResolutionByTensor, get_size
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy"))
|
||||
|
||||
|
||||
class CImagePreviewFromImage(PreviewImage):
|
||||
def __init__(self):
|
||||
self.output_dir = folder_paths.get_temp_directory()
|
||||
self.type = "temp"
|
||||
self.prefix_append = "_" + ''.join(random.choice("abcdefghijklmnopqrstupvxyz") for x in range(5))
|
||||
self.compress_level = 1
|
||||
self.data_cached = None
|
||||
self.data_cached_text = None
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
# if it is required, in next node does not receive any value even the cache!
|
||||
},
|
||||
"optional": {
|
||||
"image": ("IMAGE",),
|
||||
},
|
||||
"hidden": {
|
||||
"prompt": "PROMPT",
|
||||
"extra_pnginfo": "EXTRA_PNGINFO",
|
||||
},
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.IMAGE.value
|
||||
RETURN_TYPES = ("METADATA_RAW",)
|
||||
RETURN_NAMES = ("Metadata RAW",)
|
||||
OUTPUT_NODE = True
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, image=None, prompt=None, extra_pnginfo=None):
|
||||
text = ""
|
||||
title = ""
|
||||
data = {
|
||||
"result": [''],
|
||||
"ui": {
|
||||
"text": [''],
|
||||
"images": [],
|
||||
}
|
||||
}
|
||||
|
||||
if image is not None:
|
||||
saved = self.save_images(image, "crystools/i", prompt, extra_pnginfo)
|
||||
image = saved["ui"]["images"][0]
|
||||
image_path = Path(self.output_dir).joinpath(image["subfolder"], image["filename"])
|
||||
|
||||
img, promptFromImage, metadata = buildMetadata(image_path)
|
||||
|
||||
images = [image]
|
||||
result = metadata
|
||||
|
||||
data["result"] = [result]
|
||||
data["ui"]["images"] = images
|
||||
|
||||
title = "Source: Image link \n"
|
||||
text += buildPreviewText(metadata)
|
||||
text += f"Current prompt (NO FROM IMAGE!):\n"
|
||||
text += json.dumps(promptFromImage, indent=CONFIG["indent"])
|
||||
|
||||
self.data_cached_text = text
|
||||
self.data_cached = data
|
||||
|
||||
elif image is None and self.data_cached is not None:
|
||||
title = "Source: Image link - CACHED\n"
|
||||
data = self.data_cached
|
||||
text = self.data_cached_text
|
||||
|
||||
else:
|
||||
logger.debug("Source: Empty on CImagePreviewFromImage")
|
||||
text = "Source: Empty"
|
||||
|
||||
data['ui']['text'] = [title + text]
|
||||
return data
|
||||
|
||||
|
||||
class CImagePreviewFromMetadata(PreviewImage):
|
||||
def __init__(self):
|
||||
self.data_cached = None
|
||||
self.data_cached_text = None
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
# if it is required, in next node does not receive any value even the cache!
|
||||
},
|
||||
"optional": {
|
||||
"metadata_raw": METADATA_RAW,
|
||||
},
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.IMAGE.value
|
||||
RETURN_TYPES = ("METADATA_RAW",)
|
||||
RETURN_NAMES = ("Metadata RAW",)
|
||||
OUTPUT_NODE = True
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, metadata_raw=None):
|
||||
text = ""
|
||||
title = ""
|
||||
data = {
|
||||
"result": [''],
|
||||
"ui": {
|
||||
"text": [''],
|
||||
"images": [],
|
||||
}
|
||||
}
|
||||
|
||||
if metadata_raw is not None and metadata_raw != '':
|
||||
promptFromImage = {}
|
||||
if "prompt" in metadata_raw:
|
||||
promptFromImage = metadata_raw["prompt"]
|
||||
|
||||
title = "Source: Metadata RAW\n"
|
||||
text += buildPreviewText(metadata_raw)
|
||||
text += f"Prompt from image:\n"
|
||||
text += json.dumps(promptFromImage, indent=CONFIG["indent"])
|
||||
|
||||
images = self.resolveImage(metadata_raw["fileinfo"]["filename"])
|
||||
result = metadata_raw
|
||||
|
||||
data["result"] = [result]
|
||||
data["ui"]["images"] = images
|
||||
|
||||
self.data_cached_text = text
|
||||
self.data_cached = data
|
||||
|
||||
elif metadata_raw is None and self.data_cached is not None:
|
||||
title = "Source: Metadata RAW - CACHED\n"
|
||||
data = self.data_cached
|
||||
text = self.data_cached_text
|
||||
|
||||
else:
|
||||
logger.debug("Source: Empty on CImagePreviewFromMetadata")
|
||||
text = "Source: Empty"
|
||||
|
||||
data["ui"]["text"] = [title + text]
|
||||
return data
|
||||
|
||||
def resolveImage(self, filename=None):
|
||||
images = []
|
||||
|
||||
if filename is not None:
|
||||
image_input_folder = os.path.normpath(folder_paths.get_input_directory())
|
||||
image_input_folder_abs = Path(image_input_folder).resolve()
|
||||
|
||||
image_path = os.path.normpath(filename)
|
||||
image_path_abs = Path(image_path).resolve()
|
||||
|
||||
if Path(image_path_abs).is_file() is False:
|
||||
raise Exception(TEXTS.FILE_NOT_FOUND.value)
|
||||
|
||||
try:
|
||||
# get common path, should be input/output/temp folder
|
||||
common = os.path.commonpath([image_input_folder_abs, image_path_abs])
|
||||
|
||||
if common != image_input_folder:
|
||||
raise Exception("Path invalid (should be in the input folder)")
|
||||
|
||||
relative = os.path.normpath(os.path.relpath(image_path_abs, image_input_folder_abs))
|
||||
|
||||
images.append({
|
||||
"filename": Path(relative).name,
|
||||
"subfolder": os.path.dirname(relative),
|
||||
"type": "input"
|
||||
})
|
||||
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
|
||||
return images
|
||||
|
||||
|
||||
class CImageGetResolution:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"image": ("IMAGE",),
|
||||
},
|
||||
"hidden": {
|
||||
"unique_id": "UNIQUE_ID",
|
||||
"extra_pnginfo": "EXTRA_PNGINFO",
|
||||
},
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.IMAGE.value
|
||||
RETURN_TYPES = ("INT", "INT",)
|
||||
RETURN_NAMES = ("width", "height",)
|
||||
OUTPUT_NODE = True
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, image, extra_pnginfo=None, unique_id=None):
|
||||
res = getResolutionByTensor(image)
|
||||
text = [f"{res['x']}x{res['y']}"]
|
||||
setWidgetValues(text, unique_id, extra_pnginfo)
|
||||
logger.debug(f"Resolution: {text}")
|
||||
return {"ui": {"text": text}, "result": (res["x"], res["y"])}
|
||||
|
||||
|
||||
# subfolders based on: https://github.com/catscandrive/comfyui-imagesubfolders
|
||||
class CImageLoadWithMetadata:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
input_dir = folder_paths.get_input_directory()
|
||||
exclude_folders = ["clipspace"]
|
||||
file_list = []
|
||||
|
||||
for root, dirs, files in os.walk(input_dir):
|
||||
# Exclude specific folders
|
||||
dirs[:] = [d for d in dirs if d not in exclude_folders]
|
||||
|
||||
for file in files:
|
||||
relpath = os.path.relpath(os.path.join(root, file), start=input_dir)
|
||||
# fix for windows
|
||||
relpath = relpath.replace("\\", "/")
|
||||
file_list.append(relpath)
|
||||
|
||||
return {
|
||||
"required": {
|
||||
"image": (sorted(file_list), {"image_upload": True})
|
||||
},
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.IMAGE.value
|
||||
RETURN_TYPES = ("IMAGE", "MASK", "JSON", "METADATA_RAW")
|
||||
RETURN_NAMES = ("image", "mask", "prompt", "Metadata RAW")
|
||||
OUTPUT_NODE = True
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, image):
|
||||
image_path = folder_paths.get_annotated_filepath(image)
|
||||
|
||||
img, prompt, metadata = buildMetadata(image_path)
|
||||
|
||||
img = ImageOps.exif_transpose(img)
|
||||
image = img.convert("RGB")
|
||||
image = np.array(image).astype(np.float32) / 255.0
|
||||
image = torch.from_numpy(image)[None,]
|
||||
if 'A' in img.getbands():
|
||||
mask = np.array(img.getchannel('A')).astype(np.float32) / 255.0
|
||||
mask = 1. - torch.from_numpy(mask)
|
||||
else:
|
||||
mask = torch.zeros((64, 64), dtype=torch.float32, device="cpu")
|
||||
|
||||
return image, mask.unsqueeze(0), prompt, metadata
|
||||
|
||||
@classmethod
|
||||
def IS_CHANGED(cls, image):
|
||||
image_path = folder_paths.get_annotated_filepath(image)
|
||||
m = hashlib.sha256()
|
||||
with open(image_path, 'rb') as f:
|
||||
m.update(f.read())
|
||||
return m.digest().hex()
|
||||
|
||||
@classmethod
|
||||
def VALIDATE_INPUTS(cls, image):
|
||||
if not folder_paths.exists_annotated_filepath(image):
|
||||
return "Invalid image file: {}".format(image)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
class CImageSaveWithExtraMetadata(SaveImage):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.data_cached = None
|
||||
self.data_cached_text = None
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
# if it is required, in next node does not receive any value even the cache!
|
||||
"image": ("IMAGE",),
|
||||
"filename_prefix": ("STRING", {"default": "ComfyUI"}),
|
||||
"with_workflow": BOOLEAN,
|
||||
},
|
||||
"optional": {
|
||||
"metadata_extra": ("STRING", {"multiline": True, "default": json.dumps({
|
||||
"Title": "Image generated by Crystian",
|
||||
"Description": "More info: https:\/\/www.instagram.com\/crystian.ia", # "\/" is for escape / on json
|
||||
"Author": "crystian.ia",
|
||||
"Software": "ComfyUI",
|
||||
"Category": "StableDiffusion",
|
||||
"Rating": 5,
|
||||
"UserComment": "",
|
||||
"Keywords": [
|
||||
""
|
||||
],
|
||||
"Copyrights": "",
|
||||
}, indent=CONFIG["indent"]).replace("\\/", "/"),
|
||||
}),
|
||||
},
|
||||
"hidden": {
|
||||
"prompt": "PROMPT",
|
||||
"extra_pnginfo": "EXTRA_PNGINFO",
|
||||
},
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.IMAGE.value
|
||||
RETURN_TYPES = ("METADATA_RAW",)
|
||||
RETURN_NAMES = ("Metadata RAW",)
|
||||
OUTPUT_NODE = True
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, image=None, filename_prefix="ComfyUI", with_workflow=True, metadata_extra=None, prompt=None, extra_pnginfo=None):
|
||||
data = {
|
||||
"result": [''],
|
||||
"ui": {
|
||||
"text": [''],
|
||||
"images": [],
|
||||
}
|
||||
}
|
||||
if image is not None:
|
||||
if with_workflow is True:
|
||||
extra_pnginfo_new = extra_pnginfo.copy()
|
||||
prompt = prompt.copy()
|
||||
else:
|
||||
extra_pnginfo_new = None
|
||||
prompt = None
|
||||
|
||||
if metadata_extra is not None and metadata_extra != 'undefined':
|
||||
try:
|
||||
metadata_extra = json.loads(f"{{{metadata_extra}}}")
|
||||
except Exception as e:
|
||||
logger.error(f"Error parsing metadata_extra (it will send as string), error: {e}")
|
||||
metadata_extra = {"extra": str(metadata_extra)}
|
||||
|
||||
if isinstance(metadata_extra, dict):
|
||||
for k, v in metadata_extra.items():
|
||||
if extra_pnginfo_new is None:
|
||||
extra_pnginfo_new = {}
|
||||
|
||||
extra_pnginfo_new[k] = v
|
||||
|
||||
saved = super().save_images(image, filename_prefix, prompt, extra_pnginfo_new)
|
||||
|
||||
image = saved["ui"]["images"][0]
|
||||
image_path = Path(self.output_dir).joinpath(image["subfolder"], image["filename"])
|
||||
img, promptFromImage, metadata = buildMetadata(image_path)
|
||||
|
||||
images = [image]
|
||||
result = metadata
|
||||
|
||||
data["result"] = [result]
|
||||
data["ui"]["images"] = images
|
||||
|
||||
else:
|
||||
logger.debug("Source: Empty on CImageSaveWithExtraMetadata")
|
||||
|
||||
return data
|
||||
|
||||
|
||||
|
||||
def buildMetadata(image_path):
|
||||
if Path(image_path).is_file() is False:
|
||||
raise Exception(TEXTS.FILE_NOT_FOUND.value)
|
||||
|
||||
img = Image.open(image_path)
|
||||
|
||||
metadata = {}
|
||||
prompt = {}
|
||||
|
||||
metadata["fileinfo"] = {
|
||||
"filename": Path(image_path).as_posix(),
|
||||
"resolution": f"{img.width}x{img.height}",
|
||||
"date": str(datetime.fromtimestamp(os.path.getmtime(image_path))),
|
||||
"size": str(get_size(image_path)),
|
||||
}
|
||||
|
||||
# only for png files
|
||||
if isinstance(img, PngImageFile):
|
||||
metadataFromImg = img.info
|
||||
|
||||
# for all metadataFromImg convert to string (but not for workflow and prompt!)
|
||||
for k, v in metadataFromImg.items():
|
||||
# from ComfyUI
|
||||
if k == "workflow":
|
||||
try:
|
||||
metadata["workflow"] = json.loads(metadataFromImg["workflow"])
|
||||
except Exception as e:
|
||||
logger.warn(f"Error parsing metadataFromImg 'workflow': {e}")
|
||||
|
||||
# from ComfyUI
|
||||
elif k == "prompt":
|
||||
try:
|
||||
metadata["prompt"] = json.loads(metadataFromImg["prompt"])
|
||||
|
||||
# extract prompt to use on metadataFromImg
|
||||
prompt = metadata["prompt"]
|
||||
except Exception as e:
|
||||
logger.warn(f"Error parsing metadataFromImg 'prompt': {e}")
|
||||
|
||||
else:
|
||||
try:
|
||||
# for all possible metadataFromImg by user
|
||||
metadata[str(k)] = json.loads(v)
|
||||
except Exception as e:
|
||||
logger.debug(f"Error parsing {k} as json, trying as string: {e}")
|
||||
try:
|
||||
metadata[str(k)] = str(v)
|
||||
except Exception as e:
|
||||
logger.debug(f"Error parsing {k} it will be skipped: {e}")
|
||||
|
||||
if isinstance(img, JpegImageFile):
|
||||
exif = img.getexif()
|
||||
|
||||
for k, v in exif.items():
|
||||
tag = TAGS.get(k, k)
|
||||
if v is not None:
|
||||
metadata[str(tag)] = str(v)
|
||||
|
||||
for ifd_id in IFD:
|
||||
try:
|
||||
if ifd_id == IFD.GPSInfo:
|
||||
resolve = GPSTAGS
|
||||
else:
|
||||
resolve = TAGS
|
||||
|
||||
ifd = exif.get_ifd(ifd_id)
|
||||
ifd_name = str(ifd_id.name)
|
||||
metadata[ifd_name] = {}
|
||||
|
||||
for k, v in ifd.items():
|
||||
tag = resolve.get(k, k)
|
||||
metadata[ifd_name][str(tag)] = str(v)
|
||||
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
||||
return img, prompt, metadata
|
||||
|
||||
|
||||
def buildPreviewText(metadata):
|
||||
text = f"File: {metadata['fileinfo']['filename']}\n"
|
||||
text += f"Resolution: {metadata['fileinfo']['resolution']}\n"
|
||||
text += f"Date: {metadata['fileinfo']['date']}\n"
|
||||
text += f"Size: {metadata['fileinfo']['size']}\n"
|
||||
return text
|
||||
@@ -0,0 +1,149 @@
|
||||
from ..core import STRING, TEXTS, KEYS, CATEGORY, any, logger
|
||||
from ._names import CLASSES
|
||||
|
||||
|
||||
class CListAny:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
},
|
||||
"optional": {
|
||||
"any_1": (any,),
|
||||
"any_2": (any,),
|
||||
"any_3": (any,),
|
||||
"any_4": (any,),
|
||||
"any_5": (any,),
|
||||
"any_6": (any,),
|
||||
"any_7": (any,),
|
||||
"any_8": (any,),
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.LIST.value
|
||||
RETURN_TYPES = (any,),
|
||||
RETURN_NAMES = ("any_list",)
|
||||
OUTPUT_IS_LIST = (True,)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self,
|
||||
any_1=None,
|
||||
any_2=None,
|
||||
any_3=None,
|
||||
any_4=None,
|
||||
any_5=None,
|
||||
any_6=None,
|
||||
any_7=None,
|
||||
any_8=None):
|
||||
|
||||
list_any = []
|
||||
|
||||
if any_1 is not None:
|
||||
try:
|
||||
list_any.append(any_1)
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
if any_2 is not None:
|
||||
try:
|
||||
list_any.append(any_2)
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
if any_3 is not None:
|
||||
try:
|
||||
list_any.append(any_3)
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
if any_4 is not None:
|
||||
try:
|
||||
list_any.append(any_4)
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
if any_5 is not None:
|
||||
try:
|
||||
list_any.append(any_5)
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
if any_6 is not None:
|
||||
try:
|
||||
list_any.append(any_6)
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
if any_7 is not None:
|
||||
try:
|
||||
list_any.append(any_7)
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
if any_8 is not None:
|
||||
try:
|
||||
list_any.append(any_8)
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
|
||||
# yes, double brackets are needed because of the OUTPUT_IS_LIST... ¯\_(ツ)_/¯
|
||||
return [[list_any]]
|
||||
|
||||
|
||||
class CListString:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
},
|
||||
"optional": {
|
||||
"string_1": STRING,
|
||||
"string_2": STRING,
|
||||
"string_3": STRING,
|
||||
"string_4": STRING,
|
||||
"string_5": STRING,
|
||||
"string_6": STRING,
|
||||
"string_7": STRING,
|
||||
"string_8": STRING,
|
||||
"delimiter": ("STRING", {"default": " "}),
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.LIST.value
|
||||
RETURN_TYPES = ("STRING", CLASSES.CLIST_STRING_TYPE.value,)
|
||||
RETURN_NAMES = (TEXTS.CONCAT.value, KEYS.LIST.value)
|
||||
OUTPUT_IS_LIST = (False, True, )
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self,
|
||||
string_1=None,
|
||||
string_2=None,
|
||||
string_3=None,
|
||||
string_4=None,
|
||||
string_5=None,
|
||||
string_6=None,
|
||||
string_7=None,
|
||||
string_8=None,
|
||||
delimiter=""):
|
||||
|
||||
list_str = []
|
||||
|
||||
if string_1 is not None and string_1 != "":
|
||||
list_str.append(string_1)
|
||||
if string_2 is not None and string_2 != "":
|
||||
list_str.append(string_2)
|
||||
if string_3 is not None and string_3 != "":
|
||||
list_str.append(string_3)
|
||||
if string_4 is not None and string_4 != "":
|
||||
list_str.append(string_4)
|
||||
if string_5 is not None and string_5 != "":
|
||||
list_str.append(string_5)
|
||||
if string_6 is not None and string_6 != "":
|
||||
list_str.append(string_6)
|
||||
if string_7 is not None and string_7 != "":
|
||||
list_str.append(string_7)
|
||||
if string_8 is not None and string_8 != "":
|
||||
list_str.append(string_8)
|
||||
|
||||
return delimiter.join(list_str), [list_str]
|
||||
@@ -0,0 +1,164 @@
|
||||
import json
|
||||
import re
|
||||
from ..core import CATEGORY, CONFIG, METADATA_RAW, TEXTS, findJsonsDiff, logger
|
||||
|
||||
|
||||
class CMetadataExtractor:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"metadata_raw": METADATA_RAW,
|
||||
},
|
||||
"optional": {
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.METADATA.value
|
||||
RETURN_TYPES = ("JSON", "JSON", "JSON", "JSON", "STRING", "STRING")
|
||||
RETURN_NAMES = ("prompt", "workflow", "file info", "raw to JSON", "raw to property", "raw to csv")
|
||||
# OUTPUT_NODE = True
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, metadata_raw=None):
|
||||
prompt = {}
|
||||
workflow = {}
|
||||
fileinfo = {}
|
||||
text = ""
|
||||
csv = ""
|
||||
|
||||
if metadata_raw is not None and isinstance(metadata_raw, dict):
|
||||
try:
|
||||
for key, value in metadata_raw.items():
|
||||
|
||||
if isinstance(value, dict):
|
||||
# yes, double json.dumps is needed for jsons
|
||||
value = json.dumps(json.dumps(value))
|
||||
else:
|
||||
value = json.dumps(value)
|
||||
|
||||
text += f"\"{key}\"={value}\n"
|
||||
# remove spaces
|
||||
# value = re.sub(' +', ' ', value)
|
||||
value = re.sub('\n', ' ', value)
|
||||
csv += f'"{key}"\t{value}\n'
|
||||
|
||||
if csv != "":
|
||||
csv = '"key"\t"value"\n' + csv
|
||||
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
|
||||
try:
|
||||
if "prompt" in metadata_raw:
|
||||
prompt = metadata_raw["prompt"]
|
||||
else:
|
||||
raise Exception("Prompt not found in metadata_raw")
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
|
||||
try:
|
||||
if "workflow" in metadata_raw:
|
||||
workflow = metadata_raw["workflow"]
|
||||
else:
|
||||
raise Exception("Workflow not found in metadata_raw")
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
|
||||
try:
|
||||
if "fileinfo" in metadata_raw:
|
||||
fileinfo = metadata_raw["fileinfo"]
|
||||
else:
|
||||
raise Exception("Fileinfo not found in metadata_raw")
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
|
||||
elif metadata_raw is None:
|
||||
logger.debug("metadata_raw is None")
|
||||
else:
|
||||
logger.warn(TEXTS.INVALID_METADATA_MSG.value)
|
||||
|
||||
return (json.dumps(prompt, indent=CONFIG["indent"]),
|
||||
json.dumps(workflow, indent=CONFIG["indent"]),
|
||||
json.dumps(fileinfo, indent=CONFIG["indent"]),
|
||||
json.dumps(metadata_raw, indent=CONFIG["indent"]),
|
||||
text, csv)
|
||||
|
||||
|
||||
class CMetadataCompare:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"metadata_raw_old": METADATA_RAW,
|
||||
"metadata_raw_new": METADATA_RAW,
|
||||
"what": (["Prompt", "Workflow", "Fileinfo"],),
|
||||
},
|
||||
"optional": {
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.METADATA.value
|
||||
RETURN_TYPES = ("JSON",)
|
||||
RETURN_NAMES = ("diff",)
|
||||
OUTPUT_NODE = True
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, what, metadata_raw_old=None, metadata_raw_new=None):
|
||||
prompt_old = {}
|
||||
workflow_old = {}
|
||||
fileinfo_old = {}
|
||||
prompt_new = {}
|
||||
workflow_new = {}
|
||||
fileinfo_new = {}
|
||||
diff = ""
|
||||
|
||||
if type(metadata_raw_old) == dict and type(metadata_raw_new) == dict:
|
||||
|
||||
if "prompt" in metadata_raw_old:
|
||||
prompt_old = metadata_raw_old["prompt"]
|
||||
else:
|
||||
logger.warn("Prompt not found in metadata_raw_old")
|
||||
|
||||
if "workflow" in metadata_raw_old:
|
||||
workflow_old = metadata_raw_old["workflow"]
|
||||
else:
|
||||
logger.warn("Workflow not found in metadata_raw_old")
|
||||
|
||||
if "fileinfo" in metadata_raw_old:
|
||||
fileinfo_old = metadata_raw_old["fileinfo"]
|
||||
else:
|
||||
logger.warn("Fileinfo not found in metadata_raw_old")
|
||||
|
||||
if "prompt" in metadata_raw_new:
|
||||
prompt_new = metadata_raw_new["prompt"]
|
||||
else:
|
||||
logger.warn("Prompt not found in metadata_raw_new")
|
||||
|
||||
if "workflow" in metadata_raw_new:
|
||||
workflow_new = metadata_raw_new["workflow"]
|
||||
else:
|
||||
logger.warn("Workflow not found in metadata_raw_new")
|
||||
|
||||
if "fileinfo" in metadata_raw_new:
|
||||
fileinfo_new = metadata_raw_new["fileinfo"]
|
||||
else:
|
||||
logger.warn("Fileinfo not found in metadata_raw_new")
|
||||
|
||||
if what == "Prompt":
|
||||
diff = findJsonsDiff(prompt_old, prompt_new)
|
||||
elif what == "Workflow":
|
||||
diff = findJsonsDiff(workflow_old, workflow_new)
|
||||
else:
|
||||
diff = findJsonsDiff(fileinfo_old, fileinfo_new)
|
||||
|
||||
diff = json.dumps(diff, indent=CONFIG["indent"])
|
||||
|
||||
else:
|
||||
invalid_msg = TEXTS.INVALID_METADATA_MSG.value
|
||||
logger.warn(invalid_msg)
|
||||
diff = invalid_msg
|
||||
|
||||
return {"ui": {"text": [diff]}, "result": (diff,)}
|
||||
@@ -0,0 +1,74 @@
|
||||
from ..core import CATEGORY, any
|
||||
from ._names import CLASSES
|
||||
|
||||
|
||||
class CPipeToAny:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {},
|
||||
"optional": {
|
||||
CLASSES.CPIPE_ANY_TYPE.value: (CLASSES.CPIPE_ANY_TYPE.value,),
|
||||
"any_1": (any,),
|
||||
"any_2": (any,),
|
||||
"any_3": (any,),
|
||||
"any_4": (any,),
|
||||
"any_5": (any,),
|
||||
"any_6": (any,),
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.PIPE.value
|
||||
RETURN_TYPES = (CLASSES.CPIPE_ANY_TYPE.value,)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, CPipeAny=None, any_1=None, any_2=None, any_3=None, any_4=None, any_5=None, any_6=None):
|
||||
any_1_original = None
|
||||
any_2_original = None
|
||||
any_3_original = None
|
||||
any_4_original = None
|
||||
any_5_original = None
|
||||
any_6_original = None
|
||||
|
||||
if CPipeAny != None:
|
||||
any_1_original, any_2_original, any_3_original, any_4_original, any_5_original, any_6_original = CPipeAny
|
||||
|
||||
CAnyPipeMod = []
|
||||
|
||||
CAnyPipeMod.append(any_1 if any_1 is not None else any_1_original)
|
||||
CAnyPipeMod.append(any_2 if any_2 is not None else any_2_original)
|
||||
CAnyPipeMod.append(any_3 if any_3 is not None else any_3_original)
|
||||
CAnyPipeMod.append(any_4 if any_4 is not None else any_4_original)
|
||||
CAnyPipeMod.append(any_5 if any_5 is not None else any_5_original)
|
||||
CAnyPipeMod.append(any_6 if any_6 is not None else any_6_original)
|
||||
|
||||
return (CAnyPipeMod,)
|
||||
|
||||
|
||||
class CPipeFromAny:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
CLASSES.CPIPE_ANY_TYPE.value: (CLASSES.CPIPE_ANY_TYPE.value,),
|
||||
},
|
||||
"optional": {
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.PIPE.value
|
||||
RETURN_TYPES = (CLASSES.CPIPE_ANY_TYPE.value, any, any, any, any, any, any,)
|
||||
RETURN_NAMES = (CLASSES.CPIPE_ANY_TYPE.value, "any_1", "any_2", "any_3", "any_4", "any_5", "any_6",)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, CPipeAny=None, ):
|
||||
any_1, any_2, any_3, any_4, any_5, any_6 = CPipeAny
|
||||
return CPipeAny, any_1, any_2, any_3, any_4, any_5, any_6
|
||||
@@ -0,0 +1,111 @@
|
||||
from ..core import BOOLEAN, CATEGORY, STRING, INT, FLOAT, STRING_ML
|
||||
|
||||
|
||||
class CBoolean:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"boolean": BOOLEAN,
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.PRIMITIVE.value
|
||||
RETURN_TYPES = ("BOOLEAN",)
|
||||
RETURN_NAMES = ("boolean",)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, boolean=True):
|
||||
return (boolean,)
|
||||
|
||||
|
||||
class CText:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"string": STRING,
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.PRIMITIVE.value
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("string",)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, string=""):
|
||||
return (string,)
|
||||
|
||||
|
||||
class CTextML:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"string": STRING_ML,
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.PRIMITIVE.value
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("string",)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, string=""):
|
||||
return (string,)
|
||||
|
||||
|
||||
class CInteger:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"int": INT,
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.PRIMITIVE.value
|
||||
RETURN_TYPES = ("INT",)
|
||||
RETURN_NAMES = ("int",)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, int=True):
|
||||
return (int,)
|
||||
|
||||
|
||||
class CFloat:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"float": FLOAT,
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.PRIMITIVE.value
|
||||
RETURN_TYPES = ("FLOAT",)
|
||||
RETURN_NAMES = ("float",)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, float=True):
|
||||
return (float,)
|
||||
@@ -0,0 +1,173 @@
|
||||
from ..core import BOOLEAN, STRING, CATEGORY, any, logger
|
||||
|
||||
|
||||
class CSwitchBooleanAny:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"on_true": (any, {}),
|
||||
"on_false": (any, {}),
|
||||
"boolean": BOOLEAN,
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.SWITCH.value
|
||||
RETURN_TYPES = (any,)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, on_true, on_false, boolean=True):
|
||||
logger.debug("Any switch: " + str(boolean))
|
||||
|
||||
if boolean:
|
||||
return (on_true,)
|
||||
else:
|
||||
return (on_false,)
|
||||
|
||||
|
||||
class CSwitchBooleanString:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"on_true": STRING,
|
||||
"on_false": STRING,
|
||||
"boolean": BOOLEAN,
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.SWITCH.value
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("string",)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, on_true, on_false, boolean=True):
|
||||
logger.debug("String switch: " + str(boolean))
|
||||
|
||||
if boolean:
|
||||
return (on_true,)
|
||||
else:
|
||||
return (on_false,)
|
||||
|
||||
|
||||
class CSwitchBooleanConditioning:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"on_true": ("CONDITIONING",),
|
||||
"on_false": ("CONDITIONING",),
|
||||
"boolean": BOOLEAN,
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.SWITCH.value
|
||||
RETURN_TYPES = ("CONDITIONING",)
|
||||
RETURN_NAMES = ("conditioning",)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, on_true, on_false, boolean=True):
|
||||
logger.debug("Conditioning switch: " + str(boolean))
|
||||
|
||||
if boolean:
|
||||
return (on_true,)
|
||||
else:
|
||||
return (on_false,)
|
||||
|
||||
|
||||
class CSwitchBooleanImage:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"on_true": ("IMAGE",),
|
||||
"on_false": ("IMAGE",),
|
||||
"boolean": BOOLEAN,
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.SWITCH.value
|
||||
RETURN_TYPES = ("IMAGE",)
|
||||
RETURN_NAMES = ("image",)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, on_true, on_false, boolean=True):
|
||||
logger.debug("Image switch: " + str(boolean))
|
||||
|
||||
if boolean:
|
||||
return (on_true,)
|
||||
else:
|
||||
return (on_false,)
|
||||
|
||||
class CSwitchBooleanLatent:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"on_true": ("LATENT",),
|
||||
"on_false": ("LATENT",),
|
||||
"boolean": BOOLEAN,
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.SWITCH.value
|
||||
RETURN_TYPES = ("LATENT",)
|
||||
RETURN_NAMES = ("latent",)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, on_true, on_false, boolean=True):
|
||||
logger.debug("Latent switch: " + str(boolean))
|
||||
|
||||
if boolean:
|
||||
return (on_true,)
|
||||
else:
|
||||
return (on_false,)
|
||||
|
||||
|
||||
class CSwitchBooleanMask:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"on_true": ("MASK",),
|
||||
"on_false": ("MASK",),
|
||||
"boolean": BOOLEAN,
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.SWITCH.value
|
||||
RETURN_TYPES = ("MASK",)
|
||||
RETURN_NAMES = ("mask",)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, on_true, on_false, boolean=True):
|
||||
logger.debug("Mask switch: " + str(boolean))
|
||||
|
||||
if boolean:
|
||||
return (on_true,)
|
||||
else:
|
||||
return (on_false,)
|
||||
@@ -0,0 +1,55 @@
|
||||
from ..core import CATEGORY, JSON_WIDGET, findJsonStrDiff, get_system_stats, logger
|
||||
|
||||
|
||||
class CUtilsCompareJsons:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"json_old": JSON_WIDGET,
|
||||
"json_new": JSON_WIDGET,
|
||||
},
|
||||
"optional": {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.UTILS.value
|
||||
RETURN_TYPES = ("JSON",)
|
||||
RETURN_NAMES = ("json_compared",)
|
||||
OUTPUT_NODE = True
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, json_old, json_new):
|
||||
json = findJsonStrDiff(json_old, json_new)
|
||||
return (str(json),)
|
||||
|
||||
|
||||
# Credits to: https://github.com/WASasquatch/was-node-suite-comfyui for the following node!
|
||||
class CUtilsStatSystem:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"latent": ("LATENT",),
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = CATEGORY.MAIN.value + CATEGORY.UTILS.value
|
||||
RETURN_TYPES = ("LATENT",)
|
||||
RETURN_NAMES = ("latent",)
|
||||
|
||||
FUNCTION = "execute"
|
||||
|
||||
def execute(self, latent):
|
||||
log = "Samples Passthrough:\n"
|
||||
for stat in get_system_stats():
|
||||
log += stat + "\n"
|
||||
|
||||
logger.debug(log)
|
||||
|
||||
return {"ui": {"text": [log]}, "result": (latent,)}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "crystools-typescript",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "tsc --watch",
|
||||
"tsc": "tsc",
|
||||
"lint": "eslint web --ext ts --report-unused-disable-directives --max-warnings 0",
|
||||
"lint-fix": "eslint web --ext ts --fix",
|
||||
"validate": "npm run tsc && npm run lint"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "6.18.1",
|
||||
"@typescript-eslint/parser": "6.18.1",
|
||||
"eslint": "8.56.0",
|
||||
"eslint-plugin-import": "2.29.1",
|
||||
"typescript": "5.3.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
deepdiff
|
||||
torch
|
||||
numpy
|
||||
Pillow>=9.5.0
|
||||
pynvml
|
||||
py-cpuinfo
|
||||
@@ -0,0 +1,102 @@
|
||||
{
|
||||
"last_node_id": 4,
|
||||
"last_link_id": 4,
|
||||
"nodes": [
|
||||
{
|
||||
"id": 3,
|
||||
"type": "Show any [Crystools]",
|
||||
"pos": [
|
||||
475,
|
||||
250
|
||||
],
|
||||
"size": {
|
||||
"0": 400,
|
||||
"1": 750
|
||||
},
|
||||
"flags": {},
|
||||
"order": 1,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "any_value",
|
||||
"type": "*",
|
||||
"link": 3
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Show any [Crystools]"
|
||||
},
|
||||
"widgets_values": [
|
||||
false,
|
||||
true,
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"type": "Load image with metadata [Crystools]",
|
||||
"pos": [
|
||||
100,
|
||||
75
|
||||
],
|
||||
"size": [
|
||||
325,
|
||||
350
|
||||
],
|
||||
"flags": {},
|
||||
"order": 0,
|
||||
"mode": 0,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "image",
|
||||
"type": "IMAGE",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
},
|
||||
{
|
||||
"name": "mask",
|
||||
"type": "MASK",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
},
|
||||
{
|
||||
"name": "prompt",
|
||||
"type": "JSON",
|
||||
"links": [
|
||||
3
|
||||
],
|
||||
"shape": 3,
|
||||
"slot_index": 2
|
||||
},
|
||||
{
|
||||
"name": "Metadata RAW",
|
||||
"type": "METADATA_RAW",
|
||||
"links": [],
|
||||
"shape": 3,
|
||||
"slot_index": 3
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Load image with metadata [Crystools]"
|
||||
},
|
||||
"widgets_values": [
|
||||
"tests/ComfyUI_00314_20-8-euler.png",
|
||||
"image"
|
||||
]
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
[
|
||||
3,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
0,
|
||||
"*"
|
||||
]
|
||||
],
|
||||
"groups": [],
|
||||
"config": {},
|
||||
"extra": {},
|
||||
"version": 0.4
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
{
|
||||
"last_node_id": 4,
|
||||
"last_link_id": 4,
|
||||
"nodes": [
|
||||
{
|
||||
"id": 4,
|
||||
"type": "Show any to JSON [Crystools]",
|
||||
"pos": [
|
||||
900,
|
||||
175
|
||||
],
|
||||
"size": {
|
||||
"0": 400,
|
||||
"1": 825
|
||||
},
|
||||
"flags": {},
|
||||
"order": 3,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "any_value",
|
||||
"type": "*",
|
||||
"link": 4
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "string",
|
||||
"type": "STRING",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Show any to JSON [Crystools]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": "Show any to JSON [Crystools]",
|
||||
"pos": [
|
||||
1350,
|
||||
50
|
||||
],
|
||||
"size": [
|
||||
400,
|
||||
950
|
||||
],
|
||||
"flags": {},
|
||||
"order": 1,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "any_value",
|
||||
"type": "*",
|
||||
"link": 2
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "string",
|
||||
"type": "STRING",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Show any to JSON [Crystools]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"type": "Show any [Crystools]",
|
||||
"pos": [
|
||||
475,
|
||||
250
|
||||
],
|
||||
"size": [
|
||||
400,
|
||||
750
|
||||
],
|
||||
"flags": {},
|
||||
"order": 2,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "any_value",
|
||||
"type": "*",
|
||||
"link": 3
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Show any [Crystools]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"type": "Load image with metadata [Crystools]",
|
||||
"pos": [
|
||||
100,
|
||||
75
|
||||
],
|
||||
"size": [
|
||||
325,
|
||||
350
|
||||
],
|
||||
"flags": {},
|
||||
"order": 0,
|
||||
"mode": 0,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "image",
|
||||
"type": "IMAGE",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
},
|
||||
{
|
||||
"name": "mask",
|
||||
"type": "MASK",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
},
|
||||
{
|
||||
"name": "prompt",
|
||||
"type": "JSON",
|
||||
"links": [
|
||||
2,
|
||||
3
|
||||
],
|
||||
"shape": 3,
|
||||
"slot_index": 2
|
||||
},
|
||||
{
|
||||
"name": "Metadata RAW",
|
||||
"type": "METADATA_RAW",
|
||||
"links": [
|
||||
4
|
||||
],
|
||||
"shape": 3,
|
||||
"slot_index": 3
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Load image with metadata [Crystools]"
|
||||
},
|
||||
"widgets_values": [
|
||||
"tests/ComfyUI_00314_20-8-euler.png",
|
||||
"image"
|
||||
]
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
[
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
0,
|
||||
"*"
|
||||
],
|
||||
[
|
||||
3,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
0,
|
||||
"*"
|
||||
],
|
||||
[
|
||||
4,
|
||||
1,
|
||||
3,
|
||||
4,
|
||||
0,
|
||||
"*"
|
||||
]
|
||||
],
|
||||
"groups": [],
|
||||
"config": {},
|
||||
"extra": {},
|
||||
"version": 0.4
|
||||
}
|
||||
@@ -0,0 +1,382 @@
|
||||
{
|
||||
"last_node_id": 13,
|
||||
"last_link_id": 11,
|
||||
"nodes": [
|
||||
{
|
||||
"id": 7,
|
||||
"type": "CLIPTextEncode",
|
||||
"pos": [
|
||||
413,
|
||||
389
|
||||
],
|
||||
"size": {
|
||||
"0": 425.27801513671875,
|
||||
"1": 180.6060791015625
|
||||
},
|
||||
"flags": {},
|
||||
"order": 4,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "clip",
|
||||
"type": "CLIP",
|
||||
"link": 5
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "CONDITIONING",
|
||||
"type": "CONDITIONING",
|
||||
"links": [
|
||||
6
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CLIPTextEncode"
|
||||
},
|
||||
"widgets_values": [
|
||||
"text, watermark"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"type": "CLIPTextEncode",
|
||||
"pos": [
|
||||
415,
|
||||
186
|
||||
],
|
||||
"size": {
|
||||
"0": 422.84503173828125,
|
||||
"1": 164.31304931640625
|
||||
},
|
||||
"flags": {},
|
||||
"order": 3,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "clip",
|
||||
"type": "CLIP",
|
||||
"link": 3
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "CONDITIONING",
|
||||
"type": "CONDITIONING",
|
||||
"links": [
|
||||
4
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CLIPTextEncode"
|
||||
},
|
||||
"widgets_values": [
|
||||
"beautiful scenery nature glass bottle landscape, , purple galaxy bottle,"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"type": "EmptyLatentImage",
|
||||
"pos": [
|
||||
473,
|
||||
609
|
||||
],
|
||||
"size": {
|
||||
"0": 315,
|
||||
"1": 106
|
||||
},
|
||||
"flags": {},
|
||||
"order": 0,
|
||||
"mode": 0,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "LATENT",
|
||||
"type": "LATENT",
|
||||
"links": [
|
||||
2
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "EmptyLatentImage"
|
||||
},
|
||||
"widgets_values": [
|
||||
512,
|
||||
512,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"type": "VAEDecode",
|
||||
"pos": [
|
||||
1209,
|
||||
188
|
||||
],
|
||||
"size": {
|
||||
"0": 210,
|
||||
"1": 46
|
||||
},
|
||||
"flags": {},
|
||||
"order": 6,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "samples",
|
||||
"type": "LATENT",
|
||||
"link": 7
|
||||
},
|
||||
{
|
||||
"name": "vae",
|
||||
"type": "VAE",
|
||||
"link": 8
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "IMAGE",
|
||||
"type": "IMAGE",
|
||||
"links": [
|
||||
9
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "VAEDecode"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"type": "SaveImage",
|
||||
"pos": [
|
||||
1451,
|
||||
189
|
||||
],
|
||||
"size": [
|
||||
200,
|
||||
275
|
||||
],
|
||||
"flags": {},
|
||||
"order": 7,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "images",
|
||||
"type": "IMAGE",
|
||||
"link": 9
|
||||
}
|
||||
],
|
||||
"properties": {},
|
||||
"widgets_values": [
|
||||
"ComfyUI"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"type": "KSampler",
|
||||
"pos": [
|
||||
863,
|
||||
186
|
||||
],
|
||||
"size": [
|
||||
325,
|
||||
475
|
||||
],
|
||||
"flags": {},
|
||||
"order": 5,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "model",
|
||||
"type": "MODEL",
|
||||
"link": 1
|
||||
},
|
||||
{
|
||||
"name": "positive",
|
||||
"type": "CONDITIONING",
|
||||
"link": 4
|
||||
},
|
||||
{
|
||||
"name": "negative",
|
||||
"type": "CONDITIONING",
|
||||
"link": 6
|
||||
},
|
||||
{
|
||||
"name": "latent_image",
|
||||
"type": "LATENT",
|
||||
"link": 2
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "LATENT",
|
||||
"type": "LATENT",
|
||||
"links": [
|
||||
7
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "KSampler"
|
||||
},
|
||||
"widgets_values": [
|
||||
156680208700286,
|
||||
"fixed",
|
||||
20,
|
||||
8,
|
||||
"euler",
|
||||
"normal",
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"type": "Show Metadata [Crystools]",
|
||||
"pos": [
|
||||
1225,
|
||||
525
|
||||
],
|
||||
"size": [
|
||||
450,
|
||||
525
|
||||
],
|
||||
"flags": {},
|
||||
"order": 1,
|
||||
"mode": 0,
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"type": "CheckpointLoaderSimple",
|
||||
"pos": [
|
||||
26,
|
||||
474
|
||||
],
|
||||
"size": {
|
||||
"0": 315,
|
||||
"1": 98
|
||||
},
|
||||
"flags": {},
|
||||
"order": 2,
|
||||
"mode": 0,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "MODEL",
|
||||
"type": "MODEL",
|
||||
"links": [
|
||||
1
|
||||
],
|
||||
"slot_index": 0
|
||||
},
|
||||
{
|
||||
"name": "CLIP",
|
||||
"type": "CLIP",
|
||||
"links": [
|
||||
3,
|
||||
5
|
||||
],
|
||||
"slot_index": 1
|
||||
},
|
||||
{
|
||||
"name": "VAE",
|
||||
"type": "VAE",
|
||||
"links": [
|
||||
8
|
||||
],
|
||||
"slot_index": 2
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CheckpointLoaderSimple"
|
||||
},
|
||||
"widgets_values": [
|
||||
"sd-v1-5-pruned-emaonly.safetensors"
|
||||
]
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
[
|
||||
1,
|
||||
4,
|
||||
0,
|
||||
3,
|
||||
0,
|
||||
"MODEL"
|
||||
],
|
||||
[
|
||||
2,
|
||||
5,
|
||||
0,
|
||||
3,
|
||||
3,
|
||||
"LATENT"
|
||||
],
|
||||
[
|
||||
3,
|
||||
4,
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
"CLIP"
|
||||
],
|
||||
[
|
||||
4,
|
||||
6,
|
||||
0,
|
||||
3,
|
||||
1,
|
||||
"CONDITIONING"
|
||||
],
|
||||
[
|
||||
5,
|
||||
4,
|
||||
1,
|
||||
7,
|
||||
0,
|
||||
"CLIP"
|
||||
],
|
||||
[
|
||||
6,
|
||||
7,
|
||||
0,
|
||||
3,
|
||||
2,
|
||||
"CONDITIONING"
|
||||
],
|
||||
[
|
||||
7,
|
||||
3,
|
||||
0,
|
||||
8,
|
||||
0,
|
||||
"LATENT"
|
||||
],
|
||||
[
|
||||
8,
|
||||
4,
|
||||
2,
|
||||
8,
|
||||
1,
|
||||
"VAE"
|
||||
],
|
||||
[
|
||||
9,
|
||||
8,
|
||||
0,
|
||||
9,
|
||||
0,
|
||||
"IMAGE"
|
||||
]
|
||||
],
|
||||
"groups": [],
|
||||
"config": {},
|
||||
"extra": {},
|
||||
"version": 0.4
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"last_node_id": 1,
|
||||
"last_link_id": 0,
|
||||
"nodes": [
|
||||
{
|
||||
"id": 1,
|
||||
"type": "Load image with metadata [Crystools]",
|
||||
"pos": [
|
||||
150,
|
||||
200
|
||||
],
|
||||
"size": [
|
||||
325,
|
||||
350
|
||||
],
|
||||
"flags": {},
|
||||
"order": 0,
|
||||
"mode": 0,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "image",
|
||||
"type": "IMAGE",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
},
|
||||
{
|
||||
"name": "mask",
|
||||
"type": "MASK",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
},
|
||||
{
|
||||
"name": "prompt",
|
||||
"type": "JSON",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
},
|
||||
{
|
||||
"name": "Metadata RAW",
|
||||
"type": "METADATA_RAW",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Load image with metadata [Crystools]"
|
||||
},
|
||||
"widgets_values": [
|
||||
"tests/ComfyUI_00314_20-8-euler.png",
|
||||
"image"
|
||||
]
|
||||
}
|
||||
],
|
||||
"links": [],
|
||||
"groups": [],
|
||||
"config": {},
|
||||
"extra": {},
|
||||
"version": 0.4
|
||||
}
|
||||
@@ -0,0 +1,373 @@
|
||||
{
|
||||
"last_node_id": 14,
|
||||
"last_link_id": 12,
|
||||
"nodes": [
|
||||
{
|
||||
"id": 7,
|
||||
"type": "CLIPTextEncode",
|
||||
"pos": [
|
||||
413,
|
||||
389
|
||||
],
|
||||
"size": {
|
||||
"0": 425.27801513671875,
|
||||
"1": 180.6060791015625
|
||||
},
|
||||
"flags": {},
|
||||
"order": 3,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "clip",
|
||||
"type": "CLIP",
|
||||
"link": 5
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "CONDITIONING",
|
||||
"type": "CONDITIONING",
|
||||
"links": [
|
||||
6
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CLIPTextEncode"
|
||||
},
|
||||
"widgets_values": [
|
||||
"text, watermark"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"type": "CLIPTextEncode",
|
||||
"pos": [
|
||||
415,
|
||||
186
|
||||
],
|
||||
"size": {
|
||||
"0": 422.84503173828125,
|
||||
"1": 164.31304931640625
|
||||
},
|
||||
"flags": {},
|
||||
"order": 2,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "clip",
|
||||
"type": "CLIP",
|
||||
"link": 3
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "CONDITIONING",
|
||||
"type": "CONDITIONING",
|
||||
"links": [
|
||||
4
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CLIPTextEncode"
|
||||
},
|
||||
"widgets_values": [
|
||||
"beautiful scenery nature glass bottle landscape, , purple galaxy bottle,"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"type": "EmptyLatentImage",
|
||||
"pos": [
|
||||
473,
|
||||
609
|
||||
],
|
||||
"size": {
|
||||
"0": 315,
|
||||
"1": 106
|
||||
},
|
||||
"flags": {},
|
||||
"order": 0,
|
||||
"mode": 0,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "LATENT",
|
||||
"type": "LATENT",
|
||||
"links": [
|
||||
2
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "EmptyLatentImage"
|
||||
},
|
||||
"widgets_values": [
|
||||
512,
|
||||
512,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"type": "VAEDecode",
|
||||
"pos": [
|
||||
1209,
|
||||
188
|
||||
],
|
||||
"size": {
|
||||
"0": 210,
|
||||
"1": 46
|
||||
},
|
||||
"flags": {},
|
||||
"order": 5,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "samples",
|
||||
"type": "LATENT",
|
||||
"link": 7
|
||||
},
|
||||
{
|
||||
"name": "vae",
|
||||
"type": "VAE",
|
||||
"link": 8
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "IMAGE",
|
||||
"type": "IMAGE",
|
||||
"links": [
|
||||
12
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "VAEDecode"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"type": "CheckpointLoaderSimple",
|
||||
"pos": [
|
||||
26,
|
||||
474
|
||||
],
|
||||
"size": {
|
||||
"0": 315,
|
||||
"1": 98
|
||||
},
|
||||
"flags": {},
|
||||
"order": 1,
|
||||
"mode": 0,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "MODEL",
|
||||
"type": "MODEL",
|
||||
"links": [
|
||||
1
|
||||
],
|
||||
"slot_index": 0
|
||||
},
|
||||
{
|
||||
"name": "CLIP",
|
||||
"type": "CLIP",
|
||||
"links": [
|
||||
3,
|
||||
5
|
||||
],
|
||||
"slot_index": 1
|
||||
},
|
||||
{
|
||||
"name": "VAE",
|
||||
"type": "VAE",
|
||||
"links": [
|
||||
8
|
||||
],
|
||||
"slot_index": 2
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CheckpointLoaderSimple"
|
||||
},
|
||||
"widgets_values": [
|
||||
"sd-v1-5-pruned-emaonly.safetensors"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"type": "KSampler",
|
||||
"pos": [
|
||||
863,
|
||||
186
|
||||
],
|
||||
"size": {
|
||||
"0": 325,
|
||||
"1": 475
|
||||
},
|
||||
"flags": {},
|
||||
"order": 4,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "model",
|
||||
"type": "MODEL",
|
||||
"link": 1
|
||||
},
|
||||
{
|
||||
"name": "positive",
|
||||
"type": "CONDITIONING",
|
||||
"link": 4
|
||||
},
|
||||
{
|
||||
"name": "negative",
|
||||
"type": "CONDITIONING",
|
||||
"link": 6
|
||||
},
|
||||
{
|
||||
"name": "latent_image",
|
||||
"type": "LATENT",
|
||||
"link": 2
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "LATENT",
|
||||
"type": "LATENT",
|
||||
"links": [
|
||||
7
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "KSampler"
|
||||
},
|
||||
"widgets_values": [
|
||||
156680208700286,
|
||||
"fixed",
|
||||
20,
|
||||
8,
|
||||
"euler",
|
||||
"normal",
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"type": "Preview from image [Crystools]",
|
||||
"pos": [
|
||||
1525,
|
||||
175
|
||||
],
|
||||
"size": [
|
||||
400,
|
||||
800
|
||||
],
|
||||
"flags": {},
|
||||
"order": 6,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "image",
|
||||
"type": "IMAGE",
|
||||
"link": 12
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "Metadata RAW",
|
||||
"type": "METADATA_RAW",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Preview from image [Crystools]"
|
||||
}
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
[
|
||||
1,
|
||||
4,
|
||||
0,
|
||||
3,
|
||||
0,
|
||||
"MODEL"
|
||||
],
|
||||
[
|
||||
2,
|
||||
5,
|
||||
0,
|
||||
3,
|
||||
3,
|
||||
"LATENT"
|
||||
],
|
||||
[
|
||||
3,
|
||||
4,
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
"CLIP"
|
||||
],
|
||||
[
|
||||
4,
|
||||
6,
|
||||
0,
|
||||
3,
|
||||
1,
|
||||
"CONDITIONING"
|
||||
],
|
||||
[
|
||||
5,
|
||||
4,
|
||||
1,
|
||||
7,
|
||||
0,
|
||||
"CLIP"
|
||||
],
|
||||
[
|
||||
6,
|
||||
7,
|
||||
0,
|
||||
3,
|
||||
2,
|
||||
"CONDITIONING"
|
||||
],
|
||||
[
|
||||
7,
|
||||
3,
|
||||
0,
|
||||
8,
|
||||
0,
|
||||
"LATENT"
|
||||
],
|
||||
[
|
||||
8,
|
||||
4,
|
||||
2,
|
||||
8,
|
||||
1,
|
||||
"VAE"
|
||||
],
|
||||
[
|
||||
12,
|
||||
8,
|
||||
0,
|
||||
14,
|
||||
0,
|
||||
"IMAGE"
|
||||
]
|
||||
],
|
||||
"groups": [],
|
||||
"config": {},
|
||||
"extra": {},
|
||||
"version": 0.4
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
{
|
||||
"last_node_id": 2,
|
||||
"last_link_id": 1,
|
||||
"nodes": [
|
||||
{
|
||||
"id": 1,
|
||||
"type": "Load image with metadata [Crystools]",
|
||||
"pos": [
|
||||
150,
|
||||
200
|
||||
],
|
||||
"size": [
|
||||
325,
|
||||
350
|
||||
],
|
||||
"flags": {},
|
||||
"order": 0,
|
||||
"mode": 0,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "image",
|
||||
"type": "IMAGE",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
},
|
||||
{
|
||||
"name": "mask",
|
||||
"type": "MASK",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
},
|
||||
{
|
||||
"name": "prompt",
|
||||
"type": "JSON",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
},
|
||||
{
|
||||
"name": "Metadata RAW",
|
||||
"type": "METADATA_RAW",
|
||||
"links": [
|
||||
1
|
||||
],
|
||||
"shape": 3,
|
||||
"slot_index": 3
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Load image with metadata [Crystools]"
|
||||
},
|
||||
"widgets_values": [
|
||||
"tests/ComfyUI_00314_20-8-euler.png",
|
||||
"image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": "Preview from metadata [Crystools]",
|
||||
"pos": [
|
||||
575,
|
||||
200
|
||||
],
|
||||
"size": [
|
||||
425,
|
||||
675
|
||||
],
|
||||
"flags": {},
|
||||
"order": 1,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "metadata_raw",
|
||||
"type": "METADATA_RAW",
|
||||
"link": 1
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "Metadata RAW",
|
||||
"type": "METADATA_RAW",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Preview from metadata [Crystools]"
|
||||
}
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
[
|
||||
1,
|
||||
1,
|
||||
3,
|
||||
2,
|
||||
0,
|
||||
"METADATA_RAW"
|
||||
]
|
||||
],
|
||||
"groups": [],
|
||||
"config": {},
|
||||
"extra": {},
|
||||
"version": 0.4
|
||||
}
|
||||
@@ -0,0 +1,512 @@
|
||||
{
|
||||
"last_node_id": 13,
|
||||
"last_link_id": 11,
|
||||
"nodes": [
|
||||
{
|
||||
"id": 7,
|
||||
"type": "CLIPTextEncode",
|
||||
"pos": [
|
||||
413,
|
||||
389
|
||||
],
|
||||
"size": {
|
||||
"0": 425.27801513671875,
|
||||
"1": 180.6060791015625
|
||||
},
|
||||
"flags": {},
|
||||
"order": 4,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "clip",
|
||||
"type": "CLIP",
|
||||
"link": 5
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "CONDITIONING",
|
||||
"type": "CONDITIONING",
|
||||
"links": [
|
||||
6
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CLIPTextEncode"
|
||||
},
|
||||
"widgets_values": [
|
||||
"text, watermark"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"type": "CLIPTextEncode",
|
||||
"pos": [
|
||||
415,
|
||||
186
|
||||
],
|
||||
"size": {
|
||||
"0": 422.84503173828125,
|
||||
"1": 164.31304931640625
|
||||
},
|
||||
"flags": {},
|
||||
"order": 3,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "clip",
|
||||
"type": "CLIP",
|
||||
"link": 3
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "CONDITIONING",
|
||||
"type": "CONDITIONING",
|
||||
"links": [
|
||||
4
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CLIPTextEncode"
|
||||
},
|
||||
"widgets_values": [
|
||||
"beautiful scenery nature glass bottle landscape, , purple galaxy bottle,"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"type": "EmptyLatentImage",
|
||||
"pos": [
|
||||
473,
|
||||
609
|
||||
],
|
||||
"size": {
|
||||
"0": 315,
|
||||
"1": 106
|
||||
},
|
||||
"flags": {},
|
||||
"order": 0,
|
||||
"mode": 0,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "LATENT",
|
||||
"type": "LATENT",
|
||||
"links": [
|
||||
2
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "EmptyLatentImage"
|
||||
},
|
||||
"widgets_values": [
|
||||
512,
|
||||
512,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"type": "CheckpointLoaderSimple",
|
||||
"pos": [
|
||||
26,
|
||||
474
|
||||
],
|
||||
"size": {
|
||||
"0": 315,
|
||||
"1": 98
|
||||
},
|
||||
"flags": {},
|
||||
"order": 1,
|
||||
"mode": 0,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "MODEL",
|
||||
"type": "MODEL",
|
||||
"links": [
|
||||
1
|
||||
],
|
||||
"slot_index": 0
|
||||
},
|
||||
{
|
||||
"name": "CLIP",
|
||||
"type": "CLIP",
|
||||
"links": [
|
||||
3,
|
||||
5
|
||||
],
|
||||
"slot_index": 1
|
||||
},
|
||||
{
|
||||
"name": "VAE",
|
||||
"type": "VAE",
|
||||
"links": [
|
||||
8
|
||||
],
|
||||
"slot_index": 2
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CheckpointLoaderSimple"
|
||||
},
|
||||
"widgets_values": [
|
||||
"SD1.5\\3d\\disneyPixarCartoon_v10.safetensors"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"type": "KSampler",
|
||||
"pos": [
|
||||
863,
|
||||
186
|
||||
],
|
||||
"size": [
|
||||
325,
|
||||
475
|
||||
],
|
||||
"flags": {},
|
||||
"order": 6,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "model",
|
||||
"type": "MODEL",
|
||||
"link": 1
|
||||
},
|
||||
{
|
||||
"name": "positive",
|
||||
"type": "CONDITIONING",
|
||||
"link": 4
|
||||
},
|
||||
{
|
||||
"name": "negative",
|
||||
"type": "CONDITIONING",
|
||||
"link": 6
|
||||
},
|
||||
{
|
||||
"name": "latent_image",
|
||||
"type": "LATENT",
|
||||
"link": 2
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "LATENT",
|
||||
"type": "LATENT",
|
||||
"links": [
|
||||
7
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "KSampler"
|
||||
},
|
||||
"widgets_values": [
|
||||
156680208700286,
|
||||
"fixed",
|
||||
20,
|
||||
8,
|
||||
"euler",
|
||||
"normal",
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"type": "VAEDecode",
|
||||
"pos": [
|
||||
1209,
|
||||
188
|
||||
],
|
||||
"size": {
|
||||
"0": 210,
|
||||
"1": 46
|
||||
},
|
||||
"flags": {},
|
||||
"order": 7,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "samples",
|
||||
"type": "LATENT",
|
||||
"link": 7
|
||||
},
|
||||
{
|
||||
"name": "vae",
|
||||
"type": "VAE",
|
||||
"link": 8
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "IMAGE",
|
||||
"type": "IMAGE",
|
||||
"links": [
|
||||
9,
|
||||
10
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "VAEDecode"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"type": "SaveImage",
|
||||
"pos": [
|
||||
1475,
|
||||
250
|
||||
],
|
||||
"size": [
|
||||
200,
|
||||
275
|
||||
],
|
||||
"flags": {},
|
||||
"order": 8,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "images",
|
||||
"type": "IMAGE",
|
||||
"link": 9
|
||||
}
|
||||
],
|
||||
"properties": {},
|
||||
"widgets_values": [
|
||||
"ComfyUI"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"type": "Get resolution [Crystools]",
|
||||
"pos": [
|
||||
1475,
|
||||
100
|
||||
],
|
||||
"size": {
|
||||
"0": 200,
|
||||
"1": 100
|
||||
},
|
||||
"flags": {},
|
||||
"order": 9,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "image",
|
||||
"type": "IMAGE",
|
||||
"link": 10
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "width",
|
||||
"type": "INT",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
},
|
||||
{
|
||||
"name": "height",
|
||||
"type": "INT",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Get resolution [Crystools]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"type": "Load image with metadata [Crystools]",
|
||||
"pos": [
|
||||
1350,
|
||||
625
|
||||
],
|
||||
"size": [
|
||||
325,
|
||||
350
|
||||
],
|
||||
"flags": {},
|
||||
"order": 2,
|
||||
"mode": 0,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "image",
|
||||
"type": "IMAGE",
|
||||
"links": [
|
||||
11
|
||||
],
|
||||
"shape": 3,
|
||||
"slot_index": 0
|
||||
},
|
||||
{
|
||||
"name": "mask",
|
||||
"type": "MASK",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
},
|
||||
{
|
||||
"name": "prompt",
|
||||
"type": "JSON",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
},
|
||||
{
|
||||
"name": "Metadata RAW",
|
||||
"type": "METADATA_RAW",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Load image with metadata [Crystools]"
|
||||
},
|
||||
"widgets_values": [
|
||||
"tests/ComfyUI_00314_20-8-euler.png",
|
||||
"image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"type": "Get resolution [Crystools]",
|
||||
"pos": [
|
||||
1725,
|
||||
625
|
||||
],
|
||||
"size": {
|
||||
"0": 200,
|
||||
"1": 100
|
||||
},
|
||||
"flags": {},
|
||||
"order": 5,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "image",
|
||||
"type": "IMAGE",
|
||||
"link": 11
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "width",
|
||||
"type": "INT",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
},
|
||||
{
|
||||
"name": "height",
|
||||
"type": "INT",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Get resolution [Crystools]"
|
||||
}
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
[
|
||||
1,
|
||||
4,
|
||||
0,
|
||||
3,
|
||||
0,
|
||||
"MODEL"
|
||||
],
|
||||
[
|
||||
2,
|
||||
5,
|
||||
0,
|
||||
3,
|
||||
3,
|
||||
"LATENT"
|
||||
],
|
||||
[
|
||||
3,
|
||||
4,
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
"CLIP"
|
||||
],
|
||||
[
|
||||
4,
|
||||
6,
|
||||
0,
|
||||
3,
|
||||
1,
|
||||
"CONDITIONING"
|
||||
],
|
||||
[
|
||||
5,
|
||||
4,
|
||||
1,
|
||||
7,
|
||||
0,
|
||||
"CLIP"
|
||||
],
|
||||
[
|
||||
6,
|
||||
7,
|
||||
0,
|
||||
3,
|
||||
2,
|
||||
"CONDITIONING"
|
||||
],
|
||||
[
|
||||
7,
|
||||
3,
|
||||
0,
|
||||
8,
|
||||
0,
|
||||
"LATENT"
|
||||
],
|
||||
[
|
||||
8,
|
||||
4,
|
||||
2,
|
||||
8,
|
||||
1,
|
||||
"VAE"
|
||||
],
|
||||
[
|
||||
9,
|
||||
8,
|
||||
0,
|
||||
9,
|
||||
0,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
10,
|
||||
8,
|
||||
0,
|
||||
10,
|
||||
0,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
11,
|
||||
12,
|
||||
0,
|
||||
13,
|
||||
0,
|
||||
"IMAGE"
|
||||
]
|
||||
],
|
||||
"groups": [],
|
||||
"config": {},
|
||||
"extra": {},
|
||||
"version": 0.4
|
||||
}
|
||||
@@ -0,0 +1,422 @@
|
||||
{
|
||||
"last_node_id": 11,
|
||||
"last_link_id": 11,
|
||||
"nodes": [
|
||||
{
|
||||
"id": 7,
|
||||
"type": "CLIPTextEncode",
|
||||
"pos": [
|
||||
413,
|
||||
389
|
||||
],
|
||||
"size": {
|
||||
"0": 425.27801513671875,
|
||||
"1": 180.6060791015625
|
||||
},
|
||||
"flags": {},
|
||||
"order": 3,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "clip",
|
||||
"type": "CLIP",
|
||||
"link": 5
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "CONDITIONING",
|
||||
"type": "CONDITIONING",
|
||||
"links": [
|
||||
6
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CLIPTextEncode"
|
||||
},
|
||||
"widgets_values": [
|
||||
"text, watermark"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"type": "CLIPTextEncode",
|
||||
"pos": [
|
||||
415,
|
||||
186
|
||||
],
|
||||
"size": {
|
||||
"0": 422.84503173828125,
|
||||
"1": 164.31304931640625
|
||||
},
|
||||
"flags": {},
|
||||
"order": 2,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "clip",
|
||||
"type": "CLIP",
|
||||
"link": 3
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "CONDITIONING",
|
||||
"type": "CONDITIONING",
|
||||
"links": [
|
||||
4
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CLIPTextEncode"
|
||||
},
|
||||
"widgets_values": [
|
||||
"beautiful scenery nature glass bottle landscape, , purple galaxy bottle,"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"type": "EmptyLatentImage",
|
||||
"pos": [
|
||||
473,
|
||||
609
|
||||
],
|
||||
"size": {
|
||||
"0": 315,
|
||||
"1": 106
|
||||
},
|
||||
"flags": {},
|
||||
"order": 0,
|
||||
"mode": 0,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "LATENT",
|
||||
"type": "LATENT",
|
||||
"links": [
|
||||
2
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "EmptyLatentImage"
|
||||
},
|
||||
"widgets_values": [
|
||||
512,
|
||||
512,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"type": "KSampler",
|
||||
"pos": [
|
||||
863,
|
||||
186
|
||||
],
|
||||
"size": [
|
||||
325,
|
||||
475
|
||||
],
|
||||
"flags": {},
|
||||
"order": 4,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "model",
|
||||
"type": "MODEL",
|
||||
"link": 1
|
||||
},
|
||||
{
|
||||
"name": "positive",
|
||||
"type": "CONDITIONING",
|
||||
"link": 4
|
||||
},
|
||||
{
|
||||
"name": "negative",
|
||||
"type": "CONDITIONING",
|
||||
"link": 6
|
||||
},
|
||||
{
|
||||
"name": "latent_image",
|
||||
"type": "LATENT",
|
||||
"link": 2
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "LATENT",
|
||||
"type": "LATENT",
|
||||
"links": [
|
||||
7
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "KSampler"
|
||||
},
|
||||
"widgets_values": [
|
||||
156680208700286,
|
||||
"fixed",
|
||||
20,
|
||||
8,
|
||||
"euler",
|
||||
"normal",
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"type": "CheckpointLoaderSimple",
|
||||
"pos": [
|
||||
26,
|
||||
474
|
||||
],
|
||||
"size": {
|
||||
"0": 315,
|
||||
"1": 98
|
||||
},
|
||||
"flags": {},
|
||||
"order": 1,
|
||||
"mode": 0,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "MODEL",
|
||||
"type": "MODEL",
|
||||
"links": [
|
||||
1
|
||||
],
|
||||
"slot_index": 0
|
||||
},
|
||||
{
|
||||
"name": "CLIP",
|
||||
"type": "CLIP",
|
||||
"links": [
|
||||
3,
|
||||
5
|
||||
],
|
||||
"slot_index": 1
|
||||
},
|
||||
{
|
||||
"name": "VAE",
|
||||
"type": "VAE",
|
||||
"links": [
|
||||
8
|
||||
],
|
||||
"slot_index": 2
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CheckpointLoaderSimple"
|
||||
},
|
||||
"widgets_values": [
|
||||
"SD1.5\\anime\\chilloutmix_NiPrunedFp32Fix.safetensors"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"type": "VAEDecode",
|
||||
"pos": [
|
||||
1209,
|
||||
188
|
||||
],
|
||||
"size": {
|
||||
"0": 210,
|
||||
"1": 46
|
||||
},
|
||||
"flags": {},
|
||||
"order": 5,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "samples",
|
||||
"type": "LATENT",
|
||||
"link": 7
|
||||
},
|
||||
{
|
||||
"name": "vae",
|
||||
"type": "VAE",
|
||||
"link": 8
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "IMAGE",
|
||||
"type": "IMAGE",
|
||||
"links": [
|
||||
10
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "VAEDecode"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"type": "Save image with extra metadata [Crystools]",
|
||||
"pos": [
|
||||
1450,
|
||||
200
|
||||
],
|
||||
"size": [
|
||||
425,
|
||||
550
|
||||
],
|
||||
"flags": {},
|
||||
"order": 6,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "image",
|
||||
"type": "IMAGE",
|
||||
"link": 10
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "Metadata RAW",
|
||||
"type": "METADATA_RAW",
|
||||
"links": [
|
||||
11
|
||||
],
|
||||
"shape": 3,
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Save image with extra metadata [Crystools]"
|
||||
},
|
||||
"widgets_values": [
|
||||
"ComfyUI",
|
||||
false,
|
||||
"{\n \"Title\": \"Image generated by Crystian\",\n \"Description\": \"More info: https:\\/\\/www.instagram.com\\/crystian.ia\",\n \"Author\": \"crystian.ia\",\n \"Software\": \"ComfyUI\",\n \"Category\": \"StableDiffusion\",\n \"Rating\": 5,\n \"UserComment\": \"\",\n \"Keywords\": [\n \"\"\n ],\n \"Copyrights\": \"\"\n}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"type": "Show any to JSON [Crystools]",
|
||||
"pos": [
|
||||
1925,
|
||||
200
|
||||
],
|
||||
"size": [
|
||||
425,
|
||||
300
|
||||
],
|
||||
"flags": {},
|
||||
"order": 7,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "any_value",
|
||||
"type": "*",
|
||||
"link": 11
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "string",
|
||||
"type": "STRING",
|
||||
"links": null,
|
||||
"shape": 3
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "Show any to JSON [Crystools]"
|
||||
}
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
[
|
||||
1,
|
||||
4,
|
||||
0,
|
||||
3,
|
||||
0,
|
||||
"MODEL"
|
||||
],
|
||||
[
|
||||
2,
|
||||
5,
|
||||
0,
|
||||
3,
|
||||
3,
|
||||
"LATENT"
|
||||
],
|
||||
[
|
||||
3,
|
||||
4,
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
"CLIP"
|
||||
],
|
||||
[
|
||||
4,
|
||||
6,
|
||||
0,
|
||||
3,
|
||||
1,
|
||||
"CONDITIONING"
|
||||
],
|
||||
[
|
||||
5,
|
||||
4,
|
||||
1,
|
||||
7,
|
||||
0,
|
||||
"CLIP"
|
||||
],
|
||||
[
|
||||
6,
|
||||
7,
|
||||
0,
|
||||
3,
|
||||
2,
|
||||
"CONDITIONING"
|
||||
],
|
||||
[
|
||||
7,
|
||||
3,
|
||||
0,
|
||||
8,
|
||||
0,
|
||||
"LATENT"
|
||||
],
|
||||
[
|
||||
8,
|
||||
4,
|
||||
2,
|
||||
8,
|
||||
1,
|
||||
"VAE"
|
||||
],
|
||||
[
|
||||
10,
|
||||
8,
|
||||
0,
|
||||
10,
|
||||
0,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
11,
|
||||
10,
|
||||
0,
|
||||
11,
|
||||
0,
|
||||
"*"
|
||||
]
|
||||
],
|
||||
"groups": [],
|
||||
"config": {},
|
||||
"extra": {},
|
||||
"version": 0.4
|
||||
}
|
||||