Skip to content

Commit 95ed7d5

Browse files
author
Peyton
committed
Added logic to deal with hidden variables.
1 parent a26219b commit 95ed7d5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

comfyui_to_python.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import json
55
import logging
66
import os
7+
import random
78
import sys
89

910
import black
@@ -230,6 +231,9 @@ def generate_workflow(self, load_order: List, filename: str = 'generated_code_wo
230231

231232
# Remove any keyword arguments from **inputs if they are not in class_def_params
232233
inputs = {key: value for key, value in inputs.items() if key in class_def_params}
234+
# Deal with hidden variables
235+
if 'unique_id' in class_def_params:
236+
inputs['unique_id'] = random.randint(1, 2**64)
233237

234238
# Create executed variable and generate code
235239
executed_variables[idx] = f'{class_type.lower().strip()}_{idx}'
@@ -429,8 +433,8 @@ def execute(self):
429433

430434
if __name__ == '__main__':
431435
# Update class parameters here
432-
input_file = 'workflow_api_serge.json'
433-
output_file = 'workflow_api_serge.py'
436+
input_file = 'workflow_api_impact3.json'
437+
output_file = 'workflow_api_impact3.py'
434438
queue_size = 10
435439

436440
# Convert ComfyUI workflow to Python

0 commit comments

Comments
 (0)