added bash script

This commit is contained in:
SayanoAI
2024-10-01 16:51:55 -04:00
parent 848083a679
commit 6d0fa33582
2 changed files with 63 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
#!/bin/bash
# Set up environment variables
ENV_NAME=$(basename "$PWD")
INSTALL_DIR="$HOME/Miniconda3"
export PATH="$INSTALL_DIR/condabin:$PATH"
COMFY_MANAGER_DIR="$(dirname "$0")/../ComfyUI-Manager"
COMFYUI_DIR="$(dirname "$0")/../.."
# Check if conda environment is available and create it if not
if conda info --envs | grep -i "$ENV_NAME"; then
echo "$ENV_NAME environment is already available"
else
echo "$ENV_NAME environment does not exist"
echo "Creating a new environment"
conda create -n "$ENV_NAME" python=3.10 -y
fi
# Activate environment
source activate "$ENV_NAME"
if [ $? -eq 0 ]; then
# Install custom node dependencies
pip install -r requirements.txt
# Install ComfyUI Manager
if [ -d "$COMFY_MANAGER_DIR" ]; then
cd "$COMFY_MANAGER_DIR"
git pull
else
git clone https://github.com/ltdrdata/ComfyUI-Manager "$COMFY_MANAGER_DIR"
pip install -r "$COMFY_MANAGER_DIR/requirements.txt"
fi
# Change the working directory to the root folder
cd "$COMFYUI_DIR"
# Install packages
pip install -r requirements.txt
mim install mmengine mmcv>=2.0.1 mmdet>=3.1.0 mmpose>=1.1.0
# Install CUDA torch
pip install torch==2.3.1+cu118 torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118
python main.py --preview-method=taesd --force-fp16 --use-pytorch-cross-attention
else
echo "Failed to activate environment..."
fi
read -p "Press any key to continue..."
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
# Set up environment variable
ENV_NAME=$(basename "$PWD")
echo "Are you sure you wish to uninstall $ENV_NAME? Close this window if you clicked this by mistake."
read -p "Press any key to continue..."
# Remove conda environment
conda remove --name "$ENV_NAME" --all
echo "Successfully uninstalled the app. Press any key to close."
read -p ""