Archived
initial commit
This commit is contained in:
commit
5441b0d8ff
10 files changed
+714
No files matched your search
@@ -0,0 +1,42 @@
|
||||
"""
|
||||
Test workflow - example ComfyScript workflow.
|
||||
|
||||
Each workflow file should have a run_workflow() function that accepts parameters.
|
||||
|
||||
comfyscript must be loaded outside of the run_workflow scope
|
||||
"""
|
||||
|
||||
from comfy_script.runtime import *
|
||||
load('http://127.0.0.1:8188/')
|
||||
from comfy_script.runtime.nodes import *
|
||||
import random
|
||||
|
||||
def run_workflow(**kwargs):
|
||||
"""
|
||||
Execute the test workflow.
|
||||
|
||||
Args:
|
||||
**kwargs: Workflow parameters (e.g., prompt, seed, steps, etc.)
|
||||
|
||||
Returns:
|
||||
dict: Result containing output data and metadata
|
||||
"""
|
||||
|
||||
prompt = kwargs.get('prompt', 'beautiful scenery')
|
||||
|
||||
with Workflow(wait=False):
|
||||
model, clip, vae = CheckpointLoaderSimple(kwargs.get('checkpoint', Checkpoints.anbanIllus_shinv1))
|
||||
conditioning = CLIPTextEncode(prompt, clip)
|
||||
conditioning2 = CLIPTextEncode(kwargs.get('negative_prompt', 'text, watermark'), clip)
|
||||
latent = EmptyLatentImage(512, 512, 1)
|
||||
seed = kwargs.get('seed', random.randint(0, 15663308700286))
|
||||
steps = kwargs.get('steps', 20)
|
||||
latent = KSampler(model, seed, steps, 8, 'euler', 'normal', conditioning, conditioning2, latent, 1)
|
||||
image = VAEDecode(latent, vae)
|
||||
preview = PreviewImage(image)
|
||||
|
||||
return {
|
||||
'prompt_id': preview.task.prompt_id,
|
||||
'status': 'queued',
|
||||
'parameters': kwargs
|
||||
}
|
||||
Reference in new issue
Block a user