File size: 2,322 Bytes
49f972e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a1c753a
49f972e
 
 
 
 
 
 
 
44a9e20
0057964
 
 
 
44a9e20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0057964
44a9e20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49f972e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash

echo "pod started"

if [[ $PUBLIC_KEY ]]
then
    mkdir -p ~/.ssh
    chmod 700 ~/.ssh
    cd ~/.ssh
    echo $PUBLIC_KEY >> authorized_keys
    chmod 700 -R ~/.ssh
    cd /
    service ssh start
fi

#!/bin/bash
if [[ -z "${HF_TOKEN}" ]] || [[ "${HF_TOKEN}" == "enter_your_huggingface_token_here" ]]
then
    echo "HF_TOKEN is not set"
else
    echo "HF_TOKEN is set, logging in..."
    huggingface-cli login --token ${HF_TOKEN}
fi


# Start nginx as reverse proxy to enable api access
service nginx start

# Start JupyterLab
jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root --NotebookApp.allow_origin='*' --NotebookApp.token='' &
echo "JupyterLab started"

# Check if there is a venv directory, if so, activate it
if [ -d "/workspace/venv" ]; then
    echo "venv directory found, activating it"
    source /workspace/venv/bin/activate
fi


# RUN COMFYUI
python3 /workspace/ComfyUI/main.py --listen


# Function to download a file if it doesn't exist
download_file() {
    local url=$1
    local target_dir=$2
    local target_file=$3

    if [ ! -f "${target_file}" ]; then
        echo "Downloading ${target_file}..."
        mkdir -p "${target_dir}"
        wget -O "${target_file}" "${url}" --progress=bar:force:noscroll
    else
        echo "${target_file} already exists, skipping download."
    fi
}


# VAE model
download_file "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/ae.sft?download=true" \
              "/ComfyUI/models/vae" \
              "/ComfyUI/models/vae/ae.sft"

# Diffusion model
download_file "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/flux1-dev.sft?download=true" \
              "/ComfyUI/models/diffusion_models" \
              "/ComfyUI/models/diffusion_models/flux1-dev.sft"

# CLIP models
download_file "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors?download=true" \
              "/ComfyUI/models/clip" \
              "/ComfyUI/models/clip/clip_l.safetensors"

download_file "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors?download=true" \
              "/ComfyUI/models/clip" \
              "/ComfyUI/models/clip/t5xxl_fp8_e4m3fn.safetensors"


echo "All required files have been checked/Downloaded!"



sleep infinity