Bjo53 commited on
Commit
52c3580
·
verified ·
1 Parent(s): 74186dd

Upload startup.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. startup.sh +24 -5
startup.sh CHANGED
@@ -13,7 +13,8 @@ fi
13
 
14
  # Install Python tools
15
  echo "[Install] Python packages..."
16
- pip3 install --break-system-packages -q openai anthropic openhands antigravity 2>/dev/null
 
17
 
18
  # Install Claude CLI
19
  echo "[Install] Claude CLI..."
@@ -23,6 +24,10 @@ npm install -g @anthropic-ai/claude-code 2>/dev/null
23
  echo "[Install] Codex CLI..."
24
  npm install -g @openai/codex 2>/dev/null
25
 
 
 
 
 
26
  # Install pip packages
27
  pip3 install --break-system-packages -q requests psutil 2>/dev/null
28
 
@@ -61,17 +66,31 @@ def backup():
61
  threading.Thread(target=backup, daemon=True).start()
62
  " &
63
 
64
- # Keep-alive ping
65
  python3 -c "
66
- import os, time, requests
67
  def ping():
68
  while True:
69
- time.sleep(3600)
70
  try:
71
  host = os.environ.get('SPACE_HOST','')
72
- if host: requests.get(f'https://{host}/', timeout=10)
 
 
73
  except: pass
74
  threading.Thread(target=ping, daemon=True).start()
75
  " &
76
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  exec uvicorn app:app --host 0.0.0.0 --port 7860 --ws websockets --proxy-headers --forwarded-allow-ips="*"
 
13
 
14
  # Install Python tools
15
  echo "[Install] Python packages..."
16
+ pip3 install --break-system-packages -q openai anthropic openhands antigravity playwright 2>/dev/null
17
+ playwright install chromium 2>/dev/null
18
 
19
  # Install Claude CLI
20
  echo "[Install] Claude CLI..."
 
24
  echo "[Install] Codex CLI..."
25
  npm install -g @openai/codex 2>/dev/null
26
 
27
+ # Install OpenCode
28
+ echo "[Install] OpenCode..."
29
+ npm install -g opencode 2>/dev/null
30
+
31
  # Install pip packages
32
  pip3 install --break-system-packages -q requests psutil 2>/dev/null
33
 
 
66
  threading.Thread(target=backup, daemon=True).start()
67
  " &
68
 
69
+ # Keep-alive ping every 5 minutes (prevents sleep)
70
  python3 -c "
71
+ import os, time, requests, threading
72
  def ping():
73
  while True:
74
+ time.sleep(300)
75
  try:
76
  host = os.environ.get('SPACE_HOST','')
77
+ if host:
78
+ requests.get(f'https://{host}/', timeout=10)
79
+ print(f'[KeepAlive] Ping at {__import__(\"datetime\").datetime.now()}')
80
  except: pass
81
  threading.Thread(target=ping, daemon=True).start()
82
  " &
83
 
84
+ # Activity simulator (prevents idle sleep)
85
+ python3 -c "
86
+ import os, time, threading
87
+ def simulate():
88
+ while True:
89
+ time.sleep(600)
90
+ try:
91
+ os.system('echo \"activity\" > /tmp/last_activity')
92
+ except: pass
93
+ threading.Thread(target=simulate, daemon=True).start()
94
+ " &
95
+
96
  exec uvicorn app:app --host 0.0.0.0 --port 7860 --ws websockets --proxy-headers --forwarded-allow-ips="*"