mirror of
https://github.com/hanzoai/studio.git
synced 2026-08-07 00:23:06 +00:00
Complete module rename across 552 files: - comfy/ → studio/ - comfy_extras/ → studio_extras/ - comfy_api/ → studio_api/ - comfy_api_nodes/ → studio_api_nodes/ - comfy_config/ → studio_config/ - comfy_execution/ → studio_execution/ - comfy/comfy_types/ → studio/node_types/ - comfyui_version.py → studio_version.py - All test directories renamed - All import statements updated - All internal identifiers renamed (ComfyNodeABC → StudioNodeABC, etc.) - All wire protocol types renamed (COMFY_* → STUDIO_*) - No backward compatibility shims — clean break - External pip packages preserved (comfyui-frontend-package, comfy-kitchen, etc.) - 518 Python files syntax-validated, 0 errors
123 lines
2.7 KiB
Python
123 lines
2.7 KiB
Python
import json
|
|
from urllib import request
|
|
|
|
#This is the Hanzo Studio api prompt format.
|
|
|
|
#If you want it for a specific workflow you can "File -> Export (API)" in the interface.
|
|
|
|
#this is the one for the default workflow
|
|
prompt_text = """
|
|
{
|
|
"3": {
|
|
"class_type": "KSampler",
|
|
"inputs": {
|
|
"cfg": 8,
|
|
"denoise": 1,
|
|
"latent_image": [
|
|
"5",
|
|
0
|
|
],
|
|
"model": [
|
|
"4",
|
|
0
|
|
],
|
|
"negative": [
|
|
"7",
|
|
0
|
|
],
|
|
"positive": [
|
|
"6",
|
|
0
|
|
],
|
|
"sampler_name": "euler",
|
|
"scheduler": "normal",
|
|
"seed": 8566257,
|
|
"steps": 20
|
|
}
|
|
},
|
|
"4": {
|
|
"class_type": "CheckpointLoaderSimple",
|
|
"inputs": {
|
|
"ckpt_name": "v1-5-pruned-emaonly.safetensors"
|
|
}
|
|
},
|
|
"5": {
|
|
"class_type": "EmptyLatentImage",
|
|
"inputs": {
|
|
"batch_size": 1,
|
|
"height": 512,
|
|
"width": 512
|
|
}
|
|
},
|
|
"6": {
|
|
"class_type": "CLIPTextEncode",
|
|
"inputs": {
|
|
"clip": [
|
|
"4",
|
|
1
|
|
],
|
|
"text": "masterpiece best quality girl"
|
|
}
|
|
},
|
|
"7": {
|
|
"class_type": "CLIPTextEncode",
|
|
"inputs": {
|
|
"clip": [
|
|
"4",
|
|
1
|
|
],
|
|
"text": "bad hands"
|
|
}
|
|
},
|
|
"8": {
|
|
"class_type": "VAEDecode",
|
|
"inputs": {
|
|
"samples": [
|
|
"3",
|
|
0
|
|
],
|
|
"vae": [
|
|
"4",
|
|
2
|
|
]
|
|
}
|
|
},
|
|
"9": {
|
|
"class_type": "SaveImage",
|
|
"inputs": {
|
|
"filename_prefix": "HanzoStudio",
|
|
"images": [
|
|
"8",
|
|
0
|
|
]
|
|
}
|
|
}
|
|
}
|
|
"""
|
|
|
|
def queue_prompt(prompt):
|
|
p = {"prompt": prompt}
|
|
|
|
# If the workflow contains API nodes, you can add an API key to the `extra_data`` field of the payload.
|
|
# p["extra_data"] = {
|
|
# "api_key_hanzo": "your-api-key-here" # replace with real key
|
|
# }
|
|
# See: https://docs.hanzo.ai/tutorials/api-nodes/overview
|
|
|
|
data = json.dumps(p).encode('utf-8')
|
|
req = request.Request("http://127.0.0.1:8188/prompt", data=data)
|
|
request.urlopen(req)
|
|
|
|
|
|
prompt = json.loads(prompt_text)
|
|
#set the text prompt for our positive CLIPTextEncode
|
|
prompt["6"]["inputs"]["text"] = "masterpiece best quality man"
|
|
|
|
#set the seed for our KSampler node
|
|
prompt["3"]["inputs"]["seed"] = 5
|
|
|
|
|
|
queue_prompt(prompt)
|
|
|
|
|