Skip to content

Commit

Permalink
Merge pull request #6 from Visionatrix/v0.0.6-flow-meta
Browse files Browse the repository at this point in the history
Full rework: easy as possible to add ComfyUI workflows
  • Loading branch information
bigcat88 authored Jun 28, 2024
2 parents 8ac3eae + 0275778 commit d2b4595
Show file tree
Hide file tree
Showing 39 changed files with 3,129 additions and 2,280 deletions.
105 changes: 105 additions & 0 deletions docs/ComfyUI2VixMigration.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
ComfyUI to Visionatrix migration
================================

If you want to adopt your ComfyUI workflow to use in Visionatrix,
you can use this guide to help you do so. There are a few steps you need to follow.


1. Install ComfyUI-Visionatrix custom nodes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

First, it is recommended to install our custom `ComfyUI-Visionatrix <https://github.com/Visionatrix/ComfyUI-Visionatrix>`_ nodes.
Otherwise you will have to use custom nodes titles which are will be parsed by Visionatrix.

.. code-block:: bash
git clone https://github.com/Visionatrix/ComfyUI-Visionatrix.git
.. note::

You can do the required migration via nodes titles, which is less convenient.
The node title must be like this: ``input;Display Name;optional;advanced;order=1;custom_id=custom_name``.


2. Define the input params
^^^^^^^^^^^^^^^^^^^^^^^^^^

Visionatrix UI aims simplicity and clarity.
Define the most important input params of your ComfyUI workflow to extract
them to the Visionatrix UI as inputs, for example:

- prompt (textarea)
- negative prompt (textarea)
- prompt strength (range)
- some logic toggles (checkbox)
- input files (file)

For that you will need to attach our custom nodes as adapters to your nodes receiving these inputs
that are will be filled by the user from the Visionatrix UI.

As example, you can have a look at our `list of worklows <https://github.com/Visionatrix/VixFlowsDocs/tree/main/flows>`_ adopted to the new format.

.. note::

The list of available nodes can be found in the readme of the `ComfyUI-Visionatrix <https://github.com/Visionatrix/ComfyUI-Visionatrix>`_ repository.


2.1 Node to Input mapping via title string
******************************************

Alternatively, Visionatrix supports other Nodes mapping as an input param
via node title string separated by semicolon.

The nodes titles starting with ``input;`` keyword are considered as
Visionatrix input param.

The parameters list:

- ``input`` - keyword to define the input param
- ``Display Name`` - positional parameter, the name of the input field displayed in the UI
- ``optional`` - if present, the optional field is set to True
- ``advanced`` - if present, the advanced field is set to True
- ``order=1`` - the order of the input param in the UI
- ``custom_id=custom_name`` - the custom id of the input param

.. note::

``order`` is important if workflow accepts more than 1 file.


2.2 External nodes used via Node to Input mapping
*************************************************

In our workflows, we use some external nodes mapped as input params, that you can use as example:

- ``SDXLAspectRatioSelector`` - select input field used from `comfyui-art-venture <https://github.com/Visionatrix/comfyui-art-venture>`_ for Aspect Ratio select. Usually it's an optional and hidden to the advanced prompt options: ``input;Aspect Ratio;optional;advanced;custom_id=aspect_ratio``;
- ``LoadImage`` - default ComfyUI image loader node as image file input field. As required title: ``input;Input image;order=1``, or optional advanced: ``input;Optional helper image;optional;advanced;order=20``;


3. Map the models for automatic download
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Visionatrix simiplifies and automates the process of downloading the models.
As the third step of the migration, you need to map the models that are used in your workflow (see :ref:`models-mapping`).


4. Build the list of available flows
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The last step is to build the list of available flows in the Visionatrix UI.
Follow the steps described in `options.py <https://github.com/Visionatrix/Visionatrix/blob/main/visionatrix/options.py#L56-L59>`_ file
for ``FLOWS_URL`` and ``MODELS_CATALOG_URL`` to enable Visionatrix local workflows development mode:

Create a zip with adjusted/new flows:

.. code-block:: bash
cd ../VixFlowsDocs && zip -r ../Visionatrix/flows.zip flows && cd ../Visionatrix
And uncomment appropriate code lines in `options.py file <https://github.com/Visionatrix/Visionatrix/blob/main/visionatrix/options.py>`_ to use local versions of the flows.


5. Verify and test the workflow
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Last step is to run Visionatrix and setup your workflow to verify that everything works as expected.
3 changes: 3 additions & 0 deletions docs/TechnicalInformation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Visionatrix by default install and update these nodes:
* `rgthree-comfy <https://github.com/Visionatrix/rgthree-comfy>`_
* `comfyui_controlnet_aux <https://github.com/Visionatrix/comfyui_controlnet_aux>`_
* `ComfyUI-AutomaticCFG <https://github.com/Visionatrix/ComfyUI-AutomaticCFG>`_
* `comfyui-art-venture <https://github.com/Visionatrix/comfyui-art-venture>`_
* `was-node-suite-comfyui <https://github.com/Visionatrix/was-node-suite-comfyui>`_
* `ComfyUI-Visionatrix <https://github.com/Visionatrix/ComfyUI-Visionatrix>`_

We are gradually expanding the list.

Expand Down
77 changes: 14 additions & 63 deletions docs/VixWorkflows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Currently, there are two main issues with using ComfyUI flows for the general pu
1. It's unclear where to get the model from and how to deploy/install it – a **deployment/installation issue**
2. Without some experience, it's unclear how to just provide inputs to simple get results - a **usability issue**


.. _models-mapping:

Automatic models mapping
""""""""""""""""""""""""

Expand Down Expand Up @@ -86,68 +89,14 @@ The SHA256 hash of the model. Used to verify the integrity of the model and chec
Vix workflow overview
"""""""""""""""""""""

Visionatrix workflows consist of two files: ``flow.json`` and ``flow_comfy.json``

The main purpose of a Vix Flow is to specify how to map incoming parameters to the ComfyUI workflow for the creation endpoint of a ComfyUI task.
Starting from the Visionatrix 0.6.0, the workflow consists of a single file: ``flow_name.json``,
which is a ComfyUI workflow file adopted to Visionatrix.

.. note::

The main difference between Visionatrix and ComfyUI: A task is created with a single request, which includes both incoming text parameters and input files.

Consider the example of the VintagePortrait Vix flow:

.. code-block:: json
{
"name": "vintage_portrait",
"display_name": "Vintage Portrait",
"description": "Portrait photos in Vintage styles",
"author": "bigcat88",
"homepage": "https://github.com/bigcat88",
"license": "",
"documentation": "https://visionatrix.github.io/VixFlowsDocs/Flows/VintagePortrait.html",
"input_params": [
{
"name": "image",
"display_name": "Person's face",
"type": "image",
"optional": false,
"comfy_node_id": {
"37": {
"dest_field_name": ["inputs", "image"]
}
}
},
{
"name": "prompt",
"display_name": "Prompt",
"type": "text",
"optional": false,
"advanced": false,
"comfy_node_id": {
"29": {
"dest_field_name": ["inputs", "positive"]
}
}
},
{
"name": "pose",
"display_name": "Person's face pose",
"type": "image",
"optional": true,
"advanced": true,
"comfy_node_id": {
"44": {
"dest_field_name": ["inputs", "image"],
"node_connect": {
"node_id": "33",
"dest_field_name": ["inputs", "image_kps"]
}
}
}
}
]
}
The flow metadata fields described below are filled in the `VixUi-WorkflowMetadata` node.

"name"
''''''
Expand Down Expand Up @@ -184,12 +133,16 @@ The general license under which the flow can be used (to simplify understanding

Link to additional information about the flow.

"tags"
''''''

A list of string tags that can be used to label the categories of the flow.

"input_params"
''''''''''''''

The most important part. Based on the information from this field, the Visionatrix UI dynamically displays the interface.

The backend part fills in the ComfyUI workflow based on these data.
Starting with Visionatrix 0.6.0, the input params are parsed automatically from the adopted ComfyUI workflow.
Based on the information from this field, the Visionatrix UI dynamically displays the interface.

Technically, this is a list of objects, where each object is one input parameter, which includes:

Expand Down Expand Up @@ -238,6 +191,4 @@ Create task based on Flow
* input_params - input parameters with "type" == "text"
* files - list of input files (files should be in the order they are defined in the Vix Flow)

When this endpoint is called, a task will be created and queued for execution.

*To be continued...*
When this endpoint is called, a task will be created and queued for execution by one of available workers.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Here will leave all docs that is not suitable for Readme file.
WorkingModes.rst
GatedModels.rst
VixWorkflows.rst
ComfyUI2VixMigration.rst
TechnicalInformation.rst

Indices and tables
Expand Down
Loading

0 comments on commit d2b4595

Please sign in to comment.