Defter77 commited on
Commit
ceef86b
·
verified ·
1 Parent(s): d4e3697

Upload start.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. start.sh +31 -4
start.sh CHANGED
@@ -7,14 +7,41 @@ echo "CUDA version: $(nvcc --version 2>/dev/null || echo 'NVCC not found')"
7
  echo "GPU information: $(nvidia-smi || echo 'NVIDIA-SMI not found')"
8
  echo "==========================="
9
 
 
 
 
 
 
10
  # Start ComfyUI in the background
11
  cd /app/ComfyUI
 
12
  python3 main.py --listen 0.0.0.0 --port 8188 &
13
  COMFY_PID=$!
14
 
15
- # Wait for ComfyUI to start
16
- echo "Starting ComfyUI server..."
17
- sleep 10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  # Start the web interface
20
  cd /app
@@ -22,4 +49,4 @@ echo "Starting Gradio interface..."
22
  python3 app.py
23
 
24
  # If the Gradio app crashes, kill ComfyUI too
25
- kill $COMFY_PID
 
7
  echo "GPU information: $(nvidia-smi || echo 'NVIDIA-SMI not found')"
8
  echo "==========================="
9
 
10
+ # Create necessary directories if they don't exist
11
+ mkdir -p /app/ComfyUI/input
12
+ mkdir -p /app/ComfyUI/output
13
+ mkdir -p /app/workflows
14
+
15
  # Start ComfyUI in the background
16
  cd /app/ComfyUI
17
+ echo "Starting ComfyUI server..."
18
  python3 main.py --listen 0.0.0.0 --port 8188 &
19
  COMFY_PID=$!
20
 
21
+ # Robust check to ensure ComfyUI is actually running
22
+ echo "Waiting for ComfyUI server to initialize..."
23
+ MAX_RETRIES=30
24
+ RETRY_COUNT=0
25
+ COMFY_READY=false
26
+
27
+ while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
28
+ echo "Checking if ComfyUI is ready (attempt $((RETRY_COUNT+1))/$MAX_RETRIES)..."
29
+ if curl -s "http://localhost:8188/system_stats" > /dev/null; then
30
+ COMFY_READY=true
31
+ echo "ComfyUI server is up and running!"
32
+ break
33
+ fi
34
+ RETRY_COUNT=$((RETRY_COUNT+1))
35
+ sleep 5
36
+ done
37
+
38
+ if [ "$COMFY_READY" = false ]; then
39
+ echo "WARNING: ComfyUI server didn't respond within the expected time."
40
+ echo "The application may not function correctly."
41
+ fi
42
+
43
+ # Print message about network configuration
44
+ echo "ComfyUI should be accessible at: http://0.0.0.0:8188"
45
 
46
  # Start the web interface
47
  cd /app
 
49
  python3 app.py
50
 
51
  # If the Gradio app crashes, kill ComfyUI too
52
+ kill $COMFY_PID