Skip to content

Commit b2ce42c

Browse files
author
Peyton
committed
Renamed files and updated README and requirements.txt
1 parent 2fc41dd commit b2ce42c

File tree

4 files changed

+27
-10
lines changed

4 files changed

+27
-10
lines changed

ComfyUI-to-Python-Extension/__init__.py

Whitespace-only changes.

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Overview
22

3-
The `ComfyUI-to-Python-Extension` is a powerful tool that translates ComfyUI workflow into executable Python code. Designed to bridge the gap between ComfyUI's visual interface and Python's programming environment, this script facilitates the seamless transition from design to code execution. Whether you're a data scientist, a software developer, or an AI enthusiast, this tool streamlines the process of implementing ComfyUI workflows in Python. The output makes it easy to queue a large amount of images for generation and provides a base script to easily modify for experimination.
3+
The `ComfyUI-to-Python-Extension` is a powerful tool that translates the ComfyUI workflow into executable Python code. Designed to bridge the gap between ComfyUI's visual interface and Python's programming environment, this script facilitates the seamless transition from design to code execution. Whether you're a data scientist, a software developer, or an AI enthusiast, this tool streamlines the process of implementing ComfyUI workflows in Python. The output makes it easy to queue a large amount of images for generation and provides a base script to easily modify for experimination.
44

55
**Convert this:**
66

@@ -14,12 +14,14 @@ import random
1414
import sys
1515
1616
sys.path.append("../")
17-
from nodes import KSamplerAdvanced
18-
from nodes import EmptyLatentImage
19-
from nodes import VAEDecodeTiled
20-
from nodes import SaveImage
21-
from nodes import CheckpointLoaderSimple
22-
from nodes import CLIPTextEncode
17+
from nodes import (
18+
KSamplerAdvanced,
19+
EmptyLatentImage,
20+
VAEDecodeTiled,
21+
SaveImage,
22+
CLIPTextEncode,
23+
CheckpointLoaderSimple,
24+
)
2325
2426
2527
def main():

ComfyUI-to-Python-Extension/generate_python_code.py renamed to comfyui_to_python.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
import json
44
import logging
55
import os
6-
from typing import Dict, List, Any, Callable
76
import sys
87

8+
import black
9+
10+
from typing import Dict, List, Any, Callable
11+
912
sys.path.append('../')
1013

1114
from nodes import NODE_CLASS_MAPPINGS
1215

13-
import black
1416

1517
logging.basicConfig(level=logging.INFO)
1618

@@ -218,7 +220,7 @@ def assemble_python_code(import_statements: set, loader_code: List[str], code: L
218220
final_code (str): Generated final code as a string
219221
"""
220222
static_imports = ['import random']
221-
imports_code = [f"from nodes import {class_name}" for class_name in import_statements]
223+
imports_code = [f"from nodes import {', '.join([class_name for class_name in import_statements])}" ]
222224
main_function_code = f"def main():\n\t" + '\n\t'.join(loader_code) + f'\n\n\tfor q in {range(1, queue_size)}:\n\t' + '\n\t'.join(code)
223225
final_code = '\n'.join(static_imports + ['import sys\nsys.path.append("../")'] + imports_code + ['', main_function_code, '', 'if __name__ == "__main__":', '\tmain()'])
224226
final_code = black.format_str(final_code, mode=black.Mode())

requirements.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
torch
2+
torchdiffeq
3+
torchsde
4+
einops
5+
transformers>=4.25.1
6+
safetensors>=0.3.0
7+
aiohttp
8+
accelerate
9+
pyyaml
10+
Pillow
11+
scipy
12+
tqdm
13+
black

0 commit comments

Comments
 (0)