Avatars / start.sh
Defter77's picture
Upload start.sh with huggingface_hub
69656e5 verified
raw
history blame
2.24 kB
#!/bin/bash
# Print system information
echo "=== System Information ==="
echo "Python version: $(python3 --version)"
echo "CUDA version: $(nvcc --version 2>/dev/null || echo 'NVCC not found')"
echo "GPU information: $(nvidia-smi || echo 'NVIDIA-SMI not found')"
echo "==========================="
# Create necessary directories if they don't exist
mkdir -p /app/ComfyUI/input
mkdir -p /app/ComfyUI/output
mkdir -p /app/workflows
# Create user directory with proper permissions
mkdir -p /tmp/comfyui_user
chmod 777 /tmp/comfyui_user
# Install ComfyUI requirements to make sure frontend package is installed
echo "Installing ComfyUI requirements..."
cd /app/ComfyUI
pip install -r requirements.txt
# List the contents of key directories to debug
echo "Checking for workflow files:"
ls -la /app/workflows/ || echo "Workflow directory empty or not found"
echo "Checking for input images:"
ls -la /app/ComfyUI/input/ || echo "Input directory empty or not found"
# Download pose4.jpg image
echo "Downloading pose4.jpg image..."
curl -L -o /app/ComfyUI/input/pose4.jpg "https://huggingface.co/spaces/Defter77/Avatars/resolve/main/ComfyUI/input/pose4.jpg" || echo "Failed to download pose4.jpg"
# Download paita2.jpg image
echo "Downloading paita2.jpg image..."
curl -L -o /app/ComfyUI/input/paita2.jpg "https://huggingface.co/spaces/Defter77/Avatars/resolve/main/ComfyUI/input/paita2.jpg" || echo "Failed to download paita2.jpg"
# Verify images were downloaded
echo "Verifying downloaded images:"
ls -la /app/ComfyUI/input/
# Start ComfyUI in the background with custom user directory
cd /app/ComfyUI
echo "Starting ComfyUI server..."
python3 main.py --listen 0.0.0.0 --port 8188 --user-dir /tmp/comfyui_user &
COMFY_PID=$!
# Wait for ComfyUI to start
echo "Waiting for ComfyUI server to initialize..."
sleep 30 # Give it more time to start
# Check if ComfyUI is running
if curl -s "http://localhost:8188/system_stats" > /dev/null; then
echo "ComfyUI server is up and running!"
else
echo "WARNING: ComfyUI server might not be running correctly."
echo "Proceeding anyway..."
fi
# Start the web interface
cd /app
echo "Starting Gradio interface..."
python3 app.py
# If the Gradio app exits, kill ComfyUI too
kill $COMFY_PID