WolfDavid commited on
Commit
4e3cac9
·
1 Parent(s): 8c9985e

fix(01-05): declare the @spaces.GPU function ZeroGPU refuses to start without

Browse files

Fourth deploy (8c9985e) built, imported, bound 7860 and printed "Running on local
URL", and was then SIGTERMed by the platform:

runtime.errorMessage: "No @spaces.GPU function detected during startup"

A ZeroGPU Space will not run without a GPU entry point, and docs/HOSTING.md
records that cpu-basic Gradio Spaces are 402-gated on this account, so there is
no other free tier to move to. zerogpu_probe() therefore exists only to satisfy
the startup scan: nothing calls it, it is not on the turn path, and it raises
when DISABLE_GPU=1 - which is set on this Space.

This changes what SC-4 can assert. "No @spaces.GPU function exists" is no longer
available as a proof; "the turn loop completes without reaching one" is.

Files changed (1) hide show
  1. app.py +28 -0
app.py CHANGED
@@ -17,6 +17,7 @@ import sys
17
  from pathlib import Path
18
 
19
  import gradio as gr
 
20
 
21
  # The Space runs `python app.py` with only requirements.txt installed - it never
22
  # pip-installs this repository - so the src/ layout package is not on sys.path there and
@@ -52,6 +53,33 @@ def gpu_disabled() -> bool:
52
  return os.environ.get("DISABLE_GPU", "0").strip().lower() in {"1", "true", "yes"}
53
 
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  def _echo(text: str, slower: bool, history: str) -> tuple[str, str]:
56
  """Placeholder turn handler. Pure: state arrives as an argument and leaves as a value.
57
 
 
17
  from pathlib import Path
18
 
19
  import gradio as gr
20
+ import spaces
21
 
22
  # The Space runs `python app.py` with only requirements.txt installed - it never
23
  # pip-installs this repository - so the src/ layout package is not on sys.path there and
 
53
  return os.environ.get("DISABLE_GPU", "0").strip().lower() in {"1", "true", "yes"}
54
 
55
 
56
+ # ZeroGPU REQUIRES at least one @spaces.GPU function to exist, or it refuses to run the
57
+ # Space at all. Discovered empirically on the fourth deploy (8c9985e): the app built,
58
+ # imported, bound port 7860 and printed its "Running on local URL" line, and the platform
59
+ # then SIGTERMed it and reported
60
+ #
61
+ # runtime.errorMessage: "No @spaces.GPU function detected during startup"
62
+ #
63
+ # That is a hard platform constraint and there is no way around it: docs/HOSTING.md
64
+ # records that cpu-basic Gradio Spaces are 402-gated on this account, so ZeroGPU is the
65
+ # only free hosting path this project has.
66
+ #
67
+ # So this function exists purely to satisfy the scheduler's startup scan. It is NOT on
68
+ # the turn path, nothing in the app calls it, and it refuses to do anything when
69
+ # DISABLE_GPU is set. If SC-4's demonstration ever needs strengthening, the right assertion
70
+ # is "the turn loop completes without this function's counter moving", not "no GPU function
71
+ # exists" - the platform has taken the latter off the table.
72
+ @spaces.GPU(duration=1)
73
+ def zerogpu_probe() -> str:
74
+ """The GPU entry point ZeroGPU requires to exist. Deliberately unreachable in Phase 1."""
75
+ if gpu_disabled():
76
+ raise RuntimeError(
77
+ "zerogpu_probe called with DISABLE_GPU=1; Phase 1 has no GPU work and nothing "
78
+ "on the turn path may reach this function"
79
+ )
80
+ return "zerogpu reachable"
81
+
82
+
83
  def _echo(text: str, slower: bool, history: str) -> tuple[str, str]:
84
  """Placeholder turn handler. Pure: state arrives as an argument and leaves as a value.
85