Skip to content

Instantly share code, notes, and snippets.

# Stable Cascade
#https://huggingface.co/stabilityai/stable-cascade/resolve/main/comfyui_checkpoints/stable_cascade_stage_c.safetensors
# dir=models/checkpoints
# out=stable_cascade_stage_c.safetensors
#https://huggingface.co/stabilityai/stable-cascade/resolve/main/comfyui_checkpoints/stable_cascade_stage_b.safetensors
# dir=models/checkpoints
# out=stable_cascade_stage_b.safetensors
#https://huggingface.co/stabilityai/stable-cascade/resolve/main/controlnet/canny.safetensors
# dir=models/controlnet
# Define the installation path
INSTALL_PATH="/vast/${USER}/comfyui/"
# create directory if it doesn't exist
mkdir -p "${INSTALL_PATH}"
# create comfyui_models.txt if it doesn't exist
if [ ! -f "${INSTALL_PATH}/comfyui_models.txt" ]; then
# get the default modles file from gist: https://gist.githubusercontent.com/venetanji/7be194b3f943ff0597fa11f37d14fc1b/raw/881b73837a643db008fc13f503464a746b931eb5/comfyui_models.txt
curl -s https://gist.githubusercontent.com/venetanji/7be194b3f943ff0597fa11f37d14fc1b/raw/881b73837a643db008fc13f503464a746b931eb5/comfyui_models.txt > "${INSTALL_PATH}/comfyui_models.txt"
#!/bin/bash
# Step 0: Ensure .cache and .local link are symlinks
if [ ! -L ~/.cache ]; then
# create the directory if it doesn't exist
mkdir -p /vast/${USER}/.cache
ln -s /vast/${USER}/.cache ~/.cache
fi
if [ ! -L ~/.local ]; then
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, LCMScheduler, AutoencoderTiny
import numpy as np
import torch
import cv2
from PIL import Image
# load control net and stable diffusion v1-5
controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", torch_dtype=torch.float16)
pipe = StableDiffusionControlNetPipeline.from_pretrained(
"lykon/dreamshaper-8-lcm", controlnet=controlnet, torch_dtype=torch.float16, safety_checker = None
@venetanji
venetanji / comfyui_tool.py
Created March 21, 2025 00:48
Comfyui tool for crewai
from typing import Type
import websocket #NOTE: websocket-client (https://github.com/websocket-client/websocket-client)
import uuid
import json
import urllib.request
import urllib.parse
from crewai.tools import BaseTool
from pydantic import BaseModel, Field
from datetime import datetime