diff --git a/.gitignore b/.gitignore index 7bfa6731..08c8add3 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ comfyui.prev.log *.log web_custom_versions/ .DS_Store +login/PASSWORD +chun_test.py diff --git a/graph_setups/workflow-comfyui-flux-controlnet-ipadapter-sdxl-version-integration-F0cTkrDNS5QbJw3kNCqz-penguin_miserly_20-openart.ai.json b/graph_setups/workflow-comfyui-flux-controlnet-ipadapter-sdxl-version-integration-F0cTkrDNS5QbJw3kNCqz-penguin_miserly_20-openart.ai.json new file mode 100644 index 00000000..933078c0 --- /dev/null +++ b/graph_setups/workflow-comfyui-flux-controlnet-ipadapter-sdxl-version-integration-F0cTkrDNS5QbJw3kNCqz-penguin_miserly_20-openart.ai.json @@ -0,0 +1 @@ +{"last_node_id":112,"last_link_id":147,"nodes":[{"id":28,"type":"RandomNoise","pos":[-20,180],"size":{"0":315,"1":82},"flags":{},"order":0,"mode":0,"outputs":[{"name":"NOISE","type":"NOISE","links":[27],"shape":3}],"properties":{"Node name for S&R":"RandomNoise"},"widgets_values":[26779762323938,"fixed"]},{"id":29,"type":"BasicGuider","pos":[-20,340],"size":{"0":241.79998779296875,"1":46},"flags":{},"order":20,"mode":0,"inputs":[{"name":"model","type":"MODEL","link":33,"slot_index":0},{"name":"conditioning","type":"CONDITIONING","link":34,"slot_index":1}],"outputs":[{"name":"GUIDER","type":"GUIDER","links":[28],"shape":3}],"properties":{"Node name for S&R":"BasicGuider"}},{"id":34,"type":"UNETLoader","pos":[-510,200],"size":{"0":315,"1":82},"flags":{},"order":1,"mode":0,"outputs":[{"name":"MODEL","type":"MODEL","links":[33,111],"shape":3,"slot_index":0}],"properties":{"Node name for S&R":"UNETLoader"},"widgets_values":["flux1-dev.sft","default"]},{"id":27,"type":"SamplerCustomAdvanced","pos":[410,350],"size":{"0":360,"1":330},"flags":{},"order":24,"mode":0,"inputs":[{"name":"noise","type":"NOISE","link":27,"slot_index":0},{"name":"guider","type":"GUIDER","link":28,"slot_index":1},{"name":"sampler","type":"SAMPLER","link":29,"slot_index":2},{"name":"sigmas","type":"SIGMAS","link":30,"slot_index":3},{"name":"latent_image","type":"LATENT","link":31,"slot_index":4}],"outputs":[{"name":"output","type":"LATENT","links":[39],"shape":3,"slot_index":0},{"name":"denoised_output","type":"LATENT","links":null,"shape":3}],"properties":{"Node name for S&R":"SamplerCustomAdvanced"}},{"id":30,"type":"KSamplerSelect","pos":[-30,450],"size":{"0":315,"1":58},"flags":{},"order":2,"mode":0,"outputs":[{"name":"SAMPLER","type":"SAMPLER","links":[29],"shape":3}],"properties":{"Node name for S&R":"KSamplerSelect"},"widgets_values":["euler"]},{"id":38,"type":"DualCLIPLoader","pos":[-890,380],"size":{"0":315,"1":106},"flags":{},"order":3,"mode":0,"outputs":[{"name":"CLIP","type":"CLIP","links":[37],"shape":3}],"properties":{"Node name for S&R":"DualCLIPLoader"},"widgets_values":["t5xxl_fp8_e4m3fn.safetensors","clip_l.safetensors","flux"]},{"id":40,"type":"VAELoader","pos":[440,740],"size":{"0":315,"1":58},"flags":{},"order":4,"mode":0,"outputs":[{"name":"VAE","type":"VAE","links":[40],"shape":3}],"properties":{"Node name for S&R":"VAELoader"},"widgets_values":["ae.sft"]},{"id":31,"type":"BasicScheduler","pos":[-30,570],"size":{"0":315,"1":106},"flags":{},"order":12,"mode":0,"inputs":[{"name":"model","type":"MODEL","link":111,"slot_index":0}],"outputs":[{"name":"SIGMAS","type":"SIGMAS","links":[30],"shape":3}],"properties":{"Node name for S&R":"BasicScheduler"},"widgets_values":["normal",28,1]},{"id":32,"type":"EmptyLatentImage","pos":[-40,780],"size":{"0":315,"1":106},"flags":{},"order":5,"mode":0,"outputs":[{"name":"LATENT","type":"LATENT","links":[31,119],"shape":3,"slot_index":0}],"properties":{"Node name for S&R":"EmptyLatentImage"},"widgets_values":[1024,768,1]},{"id":91,"type":"Reroute","pos":[2070,780],"size":[90.4,26],"flags":{},"order":14,"mode":0,"inputs":[{"name":"","type":"*","link":119}],"outputs":[{"name":"LATENT","type":"LATENT","links":[120],"slot_index":0}],"properties":{"showOutputText":true,"horizontal":false}},{"id":100,"type":"IPAdapterUnifiedLoader","pos":[1660,340],"size":{"0":315,"1":78},"flags":{},"order":16,"mode":0,"inputs":[{"name":"model","type":"MODEL","link":132},{"name":"ipadapter","type":"IPADAPTER","link":null}],"outputs":[{"name":"model","type":"MODEL","links":[133],"shape":3,"slot_index":0},{"name":"ipadapter","type":"IPADAPTER","links":[134],"shape":3,"slot_index":1}],"properties":{"Node name for S&R":"IPAdapterUnifiedLoader"},"widgets_values":["PLUS (high strength)"]},{"id":98,"type":"IPAdapterAdvanced","pos":[2140,150],"size":{"0":315,"1":278},"flags":{},"order":21,"mode":0,"inputs":[{"name":"model","type":"MODEL","link":133},{"name":"ipadapter","type":"IPADAPTER","link":134,"slot_index":1},{"name":"image","type":"IMAGE","link":136,"slot_index":2},{"name":"image_negative","type":"IMAGE","link":null},{"name":"attn_mask","type":"MASK","link":null},{"name":"clip_vision","type":"CLIP_VISION","link":null}],"outputs":[{"name":"MODEL","type":"MODEL","links":[135],"shape":3,"slot_index":0}],"properties":{"Node name for S&R":"IPAdapterAdvanced"},"widgets_values":[0.8,"style transfer precise","concat",0,1,"V only"]},{"id":35,"type":"CLIPTextEncode","pos":[-550,380],"size":{"0":400,"1":200},"flags":{},"order":13,"mode":0,"inputs":[{"name":"clip","type":"CLIP","link":37,"slot_index":0}],"outputs":[{"name":"CONDITIONING","type":"CONDITIONING","links":[34],"shape":3}],"properties":{"Node name for S&R":"CLIPTextEncode"},"widgets_values":["A surreal black and white image of multiple identical figures in formal attire, standing in a row. Each figure is wearing a perfectly tailored black tuxedo with a white shirt and black bow tie. Instead of heads, the figures have dark, dense evergreen trees shaped like cones or Christmas trees. The trees are perfectly groomed and uniform in size and shape. The background is blurred, suggesting an elegant event or gala. The lighting is dramatic, creating strong contrasts between the dark suits and the white shirts. The image has a high-quality, professional photography feel with sharp focus on the figures in the foreground. Style: surrealism, high-fashion photography. Mood: mysterious, elegant, avant-garde."]},{"id":88,"type":"CLIPTextEncode","pos":[1650,470],"size":[460,180],"flags":{},"order":17,"mode":0,"inputs":[{"name":"clip","type":"CLIP","link":115}],"outputs":[{"name":"CONDITIONING","type":"CONDITIONING","links":[124],"shape":3}],"properties":{"Node name for S&R":"CLIPTextEncode"},"widgets_values":["A surreal image of multiple identical figures in formal attire, standing in a row. Each figure is wearing a perfectly tailored tuxedo with a shirt and bow tie. Instead of heads, the figures have dark, dense evergreen trees shaped like cones or Christmas trees. The trees are perfectly groomed and uniform in size and shape. Style: surrealism, illustration. Mood: mysterious, elegant, avant-garde."]},{"id":101,"type":"LoadImage","pos":[1880,-210],"size":[320,310],"flags":{},"order":6,"mode":0,"outputs":[{"name":"IMAGE","type":"IMAGE","links":[136],"shape":3},{"name":"MASK","type":"MASK","links":null,"shape":3}],"properties":{"Node name for S&R":"LoadImage"},"widgets_values":["igtu0Ds1pRQCbO2BDMb_w.png","image"]},{"id":92,"type":"VAEDecode","pos":[3030,340],"size":{"0":210,"1":46},"flags":{},"order":27,"mode":0,"inputs":[{"name":"samples","type":"LATENT","link":121},{"name":"vae","type":"VAE","link":123}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[122,138],"shape":3,"slot_index":0}],"properties":{"Node name for S&R":"VAEDecode"}},{"id":104,"type":"SetNode","pos":[3280,330],"size":{"0":210,"1":58},"flags":{"collapsed":true},"order":31,"mode":0,"inputs":[{"name":"IMAGE","type":"IMAGE","link":138}],"outputs":[{"name":"*","type":"*","links":null}],"title":"Set_output2","properties":{"previousName":"output2"},"widgets_values":["output2"]},{"id":107,"type":"GetNode","pos":[1620,1040],"size":{"0":210,"1":58},"flags":{"collapsed":true},"order":7,"mode":0,"outputs":[{"name":"IMAGE","type":"IMAGE","links":[140],"slot_index":0}],"title":"Get_output1","properties":{},"widgets_values":["output1"]},{"id":108,"type":"GetNode","pos":[1630,1090],"size":{"0":210,"1":58},"flags":{"collapsed":true},"order":8,"mode":0,"outputs":[{"name":"IMAGE","type":"IMAGE","links":[141],"slot_index":0}],"title":"Get_output2","properties":{},"widgets_values":["output2"]},{"id":41,"type":"SaveImage","pos":[850,470],"size":{"0":320,"1":270},"flags":{"collapsed":false},"order":28,"mode":0,"inputs":[{"name":"images","type":"IMAGE","link":41}],"properties":{},"widgets_values":["ComfyUI/FluxTest2"]},{"id":89,"type":"CLIPTextEncode","pos":[1670,700],"size":[430,80],"flags":{},"order":18,"mode":0,"inputs":[{"name":"clip","type":"CLIP","link":116}],"outputs":[{"name":"CONDITIONING","type":"CONDITIONING","links":[117],"shape":3,"slot_index":0}],"properties":{"Node name for S&R":"CLIPTextEncode"},"widgets_values":["(face:1.2), lowres, error, cropped, worst quality, low quality, jpeg artifacts, out of frame, watermark, signature"]},{"id":105,"type":"SetNode","pos":[1120,360],"size":{"0":210,"1":58},"flags":{"collapsed":true},"order":29,"mode":0,"inputs":[{"name":"IMAGE","type":"IMAGE","link":139}],"outputs":[{"name":"*","type":"*","links":null}],"title":"Set_output1","properties":{"previousName":"output1"},"widgets_values":["output1"]},{"id":87,"type":"CheckpointLoaderSimple","pos":[1290,350],"size":{"0":315,"1":98},"flags":{},"order":9,"mode":0,"outputs":[{"name":"MODEL","type":"MODEL","links":[132],"shape":3,"slot_index":0},{"name":"CLIP","type":"CLIP","links":[115,116],"shape":3,"slot_index":1},{"name":"VAE","type":"VAE","links":[123],"shape":3,"slot_index":2}],"properties":{"Node name for S&R":"CheckpointLoaderSimple"},"widgets_values":["SDXL\\albedobaseXL_v21.safetensors"]},{"id":95,"type":"ControlNetLoader","pos":[1300,230],"size":{"0":315,"1":58},"flags":{},"order":10,"mode":0,"outputs":[{"name":"CONTROL_NET","type":"CONTROL_NET","links":[126],"shape":3}],"properties":{"Node name for S&R":"ControlNetLoader"},"widgets_values":["krita-xinsirunion-sdxl-1.0.safetensors"]},{"id":94,"type":"ControlNetApply","pos":[1660,180],"size":{"0":317.4000244140625,"1":98},"flags":{},"order":22,"mode":0,"inputs":[{"name":"conditioning","type":"CONDITIONING","link":124},{"name":"control_net","type":"CONTROL_NET","link":126,"slot_index":1},{"name":"image","type":"IMAGE","link":128}],"outputs":[{"name":"CONDITIONING","type":"CONDITIONING","links":[125],"shape":3,"slot_index":0}],"properties":{"Node name for S&R":"ControlNetApply"},"widgets_values":[0.6]},{"id":86,"type":"KSampler","pos":[2650,340],"size":[320,470],"flags":{},"order":25,"mode":0,"inputs":[{"name":"model","type":"MODEL","link":135,"slot_index":0},{"name":"positive","type":"CONDITIONING","link":125,"slot_index":1},{"name":"negative","type":"CONDITIONING","link":117},{"name":"latent_image","type":"LATENT","link":120,"slot_index":3}],"outputs":[{"name":"LATENT","type":"LATENT","links":[121],"shape":3,"slot_index":0}],"properties":{"Node name for S&R":"KSampler"},"widgets_values":[257853693670753,"fixed",25,5,"euler","normal",1]},{"id":106,"type":"Image Comparer (rgthree)","pos":{"0":1790,"1":1030,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0},"size":[720,590],"flags":{},"order":15,"mode":0,"inputs":[{"name":"image_a","type":"IMAGE","link":140,"dir":3,"slot_index":0},{"name":"image_b","type":"IMAGE","link":141,"dir":3,"slot_index":1}],"outputs":[],"properties":{"comparer_mode":"Slide"},"widgets_values":[["/view?filename=rgthree.compare._temp_aekse_00005_.png&type=temp&subfolder=&rand=0.963788056281655","/view?filename=rgthree.compare._temp_aekse_00006_.png&type=temp&subfolder=&rand=0.935819712708708"]]},{"id":39,"type":"VAEDecode","pos":[890,350],"size":{"0":210,"1":46},"flags":{},"order":26,"mode":0,"inputs":[{"name":"samples","type":"LATENT","link":39},{"name":"vae","type":"VAE","link":40,"slot_index":1}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[41,139],"shape":3,"slot_index":0}],"properties":{"Node name for S&R":"VAEDecode"}},{"id":96,"type":"AnyLinePreprocessor","pos":[1370,100],"size":{"0":210,"1":26},"flags":{},"order":19,"mode":0,"inputs":[{"name":"image","type":"IMAGE","link":147,"slot_index":0}],"outputs":[{"name":"image","type":"IMAGE","links":[128,146],"shape":3,"slot_index":0}],"properties":{"Node name for S&R":"AnyLinePreprocessor"}},{"id":112,"type":"LoadImage","pos":[950,-50],"size":[320,310],"flags":{},"order":11,"mode":0,"outputs":[{"name":"IMAGE","type":"IMAGE","links":[147],"shape":3},{"name":"MASK","type":"MASK","links":null,"shape":3}],"properties":{"Node name for S&R":"LoadImage"},"widgets_values":["ComfyUI_00370_.png","image"]},{"id":111,"type":"PreviewImage","pos":[1620,-150],"size":{"0":210,"1":26},"flags":{},"order":23,"mode":0,"inputs":[{"name":"images","type":"IMAGE","link":146}],"properties":{"Node name for S&R":"PreviewImage"}},{"id":93,"type":"SaveImage","pos":[3030,440],"size":[320,270],"flags":{},"order":30,"mode":0,"inputs":[{"name":"images","type":"IMAGE","link":122}],"properties":{},"widgets_values":["ComfyUI/FluxTest2"]}],"links":[[27,28,0,27,0,"NOISE"],[28,29,0,27,1,"GUIDER"],[29,30,0,27,2,"SAMPLER"],[30,31,0,27,3,"SIGMAS"],[31,32,0,27,4,"LATENT"],[33,34,0,29,0,"MODEL"],[34,35,0,29,1,"CONDITIONING"],[37,38,0,35,0,"CLIP"],[39,27,0,39,0,"LATENT"],[40,40,0,39,1,"VAE"],[41,39,0,41,0,"IMAGE"],[111,34,0,31,0,"MODEL"],[115,87,1,88,0,"CLIP"],[116,87,1,89,0,"CLIP"],[117,89,0,86,2,"CONDITIONING"],[119,32,0,91,0,"*"],[120,91,0,86,3,"LATENT"],[121,86,0,92,0,"LATENT"],[122,92,0,93,0,"IMAGE"],[123,87,2,92,1,"VAE"],[124,88,0,94,0,"CONDITIONING"],[125,94,0,86,1,"CONDITIONING"],[126,95,0,94,1,"CONTROL_NET"],[128,96,0,94,2,"IMAGE"],[132,87,0,100,0,"MODEL"],[133,100,0,98,0,"MODEL"],[134,100,1,98,1,"IPADAPTER"],[135,98,0,86,0,"MODEL"],[136,101,0,98,2,"IMAGE"],[138,92,0,104,0,"*"],[139,39,0,105,0,"*"],[140,107,0,106,0,"IMAGE"],[141,108,0,106,1,"IMAGE"],[146,96,0,111,0,"IMAGE"],[147,112,0,96,0,"IMAGE"]],"groups":[],"config":{},"extra":{"ds":{"scale":1.6105100000000008,"offset":[-2352.3630710925713,-241.89013481065007]},"groupNodes":{}},"version":0.4,"widget_idx_map":{"28":{"noise_seed":0},"30":{"sampler_name":0},"31":{"scheduler":0},"86":{"seed":0,"sampler_name":4,"scheduler":5}},"components":{}} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 4c2c0b2b..4c30684f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,20 +1,216 @@ -torch -torchsde -torchvision -torchaudio -einops -transformers>=4.28.1 -tokenizers>=0.13.3 -sentencepiece -safetensors>=0.4.2 -aiohttp -pyyaml -Pillow -scipy -tqdm -psutil - -#non essential dependencies: -kornia>=0.7.1 -spandrel -soundfile +absl-py==2.1.0 +accelerate==1.2.1 +addict==2.4.0 +aiohappyeyeballs==2.4.0 +aiohttp==3.10.5 +aiohttp-session==2.12.0 +aiosignal==1.3.1 +albucore==0.0.20 +albumentations==1.4.21 +altair==5.4.1 +annotated-types==0.7.0 +antlr4-python3-runtime==4.9.3 +anyio==4.6.2.post1 +async-timeout==4.0.3 +attrs==24.2.0 +bcrypt==4.2.0 +bitsandbytes==0.44.1 +cachetools==5.5.0 +came-pytorch==0.1.3D: +certifi==2024.7.4 +cffi==1.17.1 +chardet==5.2.0 +charset-normalizer==3.3.2 +click==8.1.7 +cmake==3.30.2 +color-matcher==0.5.0 +colorama==0.4.6 +coloredlogs==15.0.1 +colorlog==6.9.0 +contourpy==1.2.1 +cryptography==43.0.0 +cssselect2==0.7.0 +cstr @ git+https://github.com/WASasquatch/cstr@0520c29a18a7a869a6e5983861d6f7a4c86f8e9b +cycler==0.12.1 +datasets==3.1.0 +ddt==1.7.2 +decord==0.6.0 +Deprecated==1.2.14 +diffusers==0.31.0 +dill==0.3.8 +diskcache==5.6.3 +docutils==0.21.2 +einops==0.8.0 +eval_type_backport==0.2.0 +exceptiongroup==1.2.2 +fairscale==0.4.13 +ffmpy @ git+https://github.com/WASasquatch/ffmpy.git@f000737698b387ffaeab7cd871b0e9185811230d +filelock==3.13.1 +flatbuffers==24.3.25 +fonttools==4.53.1 +frozenlist==1.4.1 +fsspec==2024.2.0 +ftfy==6.2.3 +fvcore==0.1.5.post20221221 +gevent==24.10.1 +gitdb==4.0.11 +GitPython==3.1.43 +greenlet==3.1.1 +h11==0.14.0 +httpcore==1.0.6 +httpx==0.27.2 +huggingface-hub==0.24.6 +humanfriendly==10.0 +idna==3.7 +imageio==2.35.1 +imageio-ffmpeg==0.5.1 +imagesize==1.4.1 +img2texture @ git+https://github.com/WASasquatch/img2texture.git@a546609a915caf1dcb84a15bf44b5b639ad924e6 +importlib_metadata==8.4.0 +intel-openmp==2021.4.0 +iopath==0.1.10 +jax==0.4.35 +jaxlib==0.4.35 +Jinja2==3.1.3 +joblib==1.4.2 +jsonschema==4.23.0 +jsonschema-specifications==2023.12.1 +kiwisolver==1.4.5 +kornia==0.7.3 +kornia_rs==0.1.5 +lazy_loader==0.4 +lion-pytorch==0.2.2 +llama_cpp_python @ https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/cpu/llama_cpp_python-0.2.89+cpuavx2-cp310-cp310-win_amd64.whl +llama_cpp_python_cuda @ https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda-0.2.89+cu121-cp310-cp310-win_amd64.whl +llvmlite==0.43.0 +lxml==5.3.0 +manifold3d==2.5.1 +mapbox_earcut==1.0.2 +markdown-it-py==3.0.0 +MarkupSafe==2.1.5 +matplotlib==3.8.0 +matrix-client==0.4.0 +mdurl==0.1.2 +mediapipe==0.10.18 +mkl==2021.4.0 +ml_dtypes==0.5.0 +mpmath==1.3.0 +mss==9.0.1 +multidict==6.0.5 +multiprocess==0.70.16 +narwhals==1.5.5 +networkx==3.2.1 +numba==0.60.0 +numpy==1.26.3 +omegaconf==2.3.0 +onnxruntime==1.19.0 +onnxruntime-gpu==1.19.2 +opencv-contrib-python==4.10.0.84 +opencv-python==4.10.0.84 +opencv-python-headless==4.10.0.84 +opt_einsum==3.4.0 +packaging==24.1 +pandas==2.2.2 +pathlib==1.0.1 +peft==0.12.0 +piexif==1.1.3 +pilgram==1.2.1 +pillow==10.4.0 +platformdirs==4.2.2 +pooch==1.8.2 +portalocker==2.10.1 +prodigyopt==1.0 +protobuf==4.25.5 +psutil==6.0.0 +py-cpuinfo==9.0.0 +pyarrow==18.0.0 +pycollada==0.8 +pycparser==2.22 +pycryptodome==3.20.0 +pydantic==2.9.2 +pydantic_core==2.23.4 +PyGithub==2.3.0 +Pygments==2.18.0 +PyJWT==2.9.0 +PyMatting==1.1.12 +PyNaCl==1.5.0 +pyparsing==3.1.2 +pyreadline3==3.4.1 +python-dateutil==2.9.0.post0 +pytz==2024.1 +PyWavelets==1.8.0 +pywin32==308 +PyYAML==6.0.2 +qrcode==8.0 +referencing==0.35.1 +regex==2024.7.24 +rembg==2.0.58 +reportlab==4.2.5 +requests==2.32.3 +requirements-parser==0.11.0 +rich==13.7.1 +rich-argparse==1.5.2 +rpds-py==0.20.0 +Rtree==1.3.0 +safetensors==0.4.4 +schedulefree==1.2.7 +scikit-image==0.24.0 +scikit-learn==1.5.1 +scipy==1.14.0 +seaborn==0.13.2 +segment-anything==1.0 +sentencepiece==0.2.0 +shapely==2.0.6 +shellingham==1.5.4 +simsimd==5.9.11 +six==1.16.0 +smmap==5.0.1 +sniffio==1.3.1 +sounddevice==0.5.1 +soundfile==0.12.1 +spandrel==0.3.4 +stringzilla==3.10.7 +svg.path==6.3 +svglib==1.5.1 +sympy==1.13.1 +tabulate==0.9.0 +tbb==2021.11.0 +termcolor==2.5.0 +threadpoolctl==3.5.0 +tifffile==2024.8.10 +timm==1.0.8 +tinycss2==1.4.0 +tokenizers==0.21.0 +tomesd==0.1.3 +toml==0.10.2 +tomli==2.0.2 +torch==2.5.0+cu121 +torchaudio==2.5.0+cu121 +torchsde==0.2.6 +torchvision==0.20.0+cu121 +tqdm==4.66.5 +trampoline==0.1.2 +transformers==4.47.1 +trimesh==4.5.1 +typer==0.12.4 +types-setuptools==72.2.0.20240821 +typing_extensions==4.12.2 +tzdata==2024.1 +ultralytics==8.2.79 +ultralytics-thop==2.0.5 +urllib3==1.26.19 +vhacdx==0.0.8.post1 +voluptuous==0.15.2 +wcwidth==0.2.13 +webcolors==24.8.0 +webencodings==0.5.1 +websocket-client==1.8.0 +wrapt==1.16.0 +xatlas==0.0.9 +xxhash==3.5.0 +yacs==0.1.8 +yapf==0.40.2 +yarl==1.9.4 +zipp==3.20.0 +zope.event==5.0 +zope.interface==7.1.0 diff --git a/script_examples/basic_login_api_example.py b/script_examples/basic_login_api_example.py new file mode 100644 index 00000000..15e0095f --- /dev/null +++ b/script_examples/basic_login_api_example.py @@ -0,0 +1,170 @@ +#This is an example that uses the websockets api to know when a prompt execution is done +#Once the prompt execution is done it downloads the images using the /history endpoint + +import websocket #NOTE: websocket-client (https://github.com/websocket-client/websocket-client) +import uuid +import json +import urllib.request +import urllib.parse + +server_address = "192.168.0.210:8188" +client_id = str(uuid.uuid4()) +# TOKEN is stored in the file `./PASSWORD`, or you can obtain it from the command line window when ComfyUI starts. +# It will appear like this: +TOKEN = "$2b$12$3VB7LtBjyEgvc.ATl9XagO2Yh9Ox0.0Nci0khTA2mv4UmkzoNyzn." +# If you get errors like: HTTP Error 400: Bad Request, please check the server's console for more detailed error message. +# Sometimes it's related to the model file's filename. + +def queue_prompt(prompt): + p = {"prompt": prompt, "client_id": client_id} + data = json.dumps(p).encode('utf-8') + req = urllib.request.Request("http://{}/prompt?token={}".format(server_address, TOKEN), data=data) + return json.loads(urllib.request.urlopen(req).read()) + +def get_image(filename, subfolder, folder_type): + data = {"filename": filename, "subfolder": subfolder, "type": folder_type} + url_values = urllib.parse.urlencode(data) + with urllib.request.urlopen("http://{}/view?{}&token={}".format(server_address, url_values, TOKEN)) as response: + return response.read() + +def get_history(prompt_id): + with urllib.request.urlopen("http://{}/history/{}?token={}".format(server_address, prompt_id, TOKEN)) as response: + return json.loads(response.read()) + +def get_images(ws, prompt): + prompt_id = queue_prompt(prompt)['prompt_id'] + output_images = {} + while True: + out = ws.recv() + if isinstance(out, str): + message = json.loads(out) + if message['type'] == 'executing': + data = message['data'] + if data['node'] is None and data['prompt_id'] == prompt_id: + break #Execution is done + else: + continue #previews are binary data + + history = get_history(prompt_id)[prompt_id] + for o in history['outputs']: + for node_id in history['outputs']: + node_output = history['outputs'][node_id] + if 'images' in node_output: + images_output = [] + for image in node_output['images']: + image_data = get_image(image['filename'], image['subfolder'], image['type']) + images_output.append(image_data) + output_images[node_id] = images_output + + return output_images + +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": "realvisxlV40_v40LightningBakedvae.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 noodles" + } + }, + "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": "ComfyUI", + "output_dir": "None", + "images": [ + "8", + 0 + ] + } + } +} +""" + +prompt = json.loads(prompt_text) +#set the text prompt for our positive CLIPTextEncode +prompt["6"]["inputs"]["text"] = "masterpiece best quality apple" + +#set the seed for our KSampler node +prompt["3"]["inputs"]["seed"] = 5 + +ws = websocket.WebSocket() +ws.connect("ws://{}/ws?clientId={}&token={}".format(server_address, client_id, TOKEN)) + +images = get_images(ws, prompt) + +#Commented out code to display the output images: + +for node_id in images: + for image_data in images[node_id]: + from PIL import Image + import io + image = Image.open(io.BytesIO(image_data)) + image.show()