#!/bin/bash # Startup script for HuggingFace Spaces # Starts ComfyUI in background, then Gradio app # Start ComfyUI server in background if [ -d "ComfyUI" ]; then echo "🚀 Starting ComfyUI server..." cd ComfyUI python main.py --listen 0.0.0.0 --port 8000 > /tmp/comfyui.log 2>&1 & COMFYUI_PID=$! cd .. # Wait for ComfyUI to start echo "⏳ Waiting for ComfyUI to start..." sleep 10 # Check if ComfyUI is running if ps -p $COMFYUI_PID > /dev/null; then echo "✅ ComfyUI server started (PID: $COMFYUI_PID)" else echo "⚠️ ComfyUI may have failed to start. Check /tmp/comfyui.log" fi else echo "⚠️ ComfyUI not found. Please install ComfyUI first." echo "Run: ./setup.sh or check README_COMFYUI_SETUP.md" fi # Start Gradio app echo "🚀 Starting Gradio app..." python app.py