Afifa Kureshi commited on
Commit
d02e2f9
·
1 Parent(s): 0264810

Fix Space startup health endpoint

Browse files
Files changed (2) hide show
  1. pyproject.toml +1 -1
  2. server/app.py +9 -3
pyproject.toml CHANGED
@@ -17,4 +17,4 @@ dependencies = [
17
  ]
18
 
19
  [project.scripts]
20
- server = "server.app:run"
 
17
  ]
18
 
19
  [project.scripts]
20
+ server = "server.app:main"
server/app.py CHANGED
@@ -15,7 +15,13 @@ def reset_env():
15
  state = env.reset()
16
  return {"status": "ok", "state": state}
17
 
18
- # You will also need to add endpoints for /step and /state based on your Pydantic models
19
- def run():
 
 
20
  import uvicorn
21
- uvicorn.run("server.app:app", host="0.0.0.0", port=7860)
 
 
 
 
 
15
  state = env.reset()
16
  return {"status": "ok", "state": state}
17
 
18
+ # --- Bottom of server/app.py ---
19
+
20
+ # Rename 'run' to 'main'
21
+ def main():
22
  import uvicorn
23
+ uvicorn.run("server.app:app", host="0.0.0.0", port=7860)
24
+
25
+ # Add the standard Python callable block
26
+ if __name__ == "__main__":
27
+ main()