alesamodio commited on
Commit
9f7896e
·
1 Parent(s): e5cae6b
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -1,5 +1,5 @@
1
  from fastapi import FastAPI
2
- import requests, os
3
 
4
  app = FastAPI()
5
 
@@ -9,14 +9,13 @@ DB3_URL = "https://alesamodio-db3-update.hf.space" # receiver Space URL
9
  def home():
10
  return {"status": "running", "message": "Minimal ping trigger alive"}
11
 
12
- @app.get("/ping")
13
  def run_trigger():
14
- import requests
15
- DB3_URL = "https://alesamodio-db3-update.hf.space"
16
  try:
17
  r = requests.get(DB3_URL, timeout=10)
18
  print(f"🌤️ Pinged receiver, status {r.status_code}")
19
- return {"status": "ok", "response": r.text[:200]}
20
  except Exception as e:
21
  print(f"❌ Error pinging receiver: {e}")
22
  return {"status": "error", "error": str(e)}
 
1
  from fastapi import FastAPI
2
+ import requests
3
 
4
  app = FastAPI()
5
 
 
9
  def home():
10
  return {"status": "running", "message": "Minimal ping trigger alive"}
11
 
12
+ @app.get("/run") # ← matches your GitHub workflow
13
  def run_trigger():
14
+ """Ping the receiver Space once to wake it up."""
 
15
  try:
16
  r = requests.get(DB3_URL, timeout=10)
17
  print(f"🌤️ Pinged receiver, status {r.status_code}")
18
+ return {"status": "ok", "code": r.status_code, "response": r.text[:200]}
19
  except Exception as e:
20
  print(f"❌ Error pinging receiver: {e}")
21
  return {"status": "error", "error": str(e)}