Spaces:
Running on Zero
Running on Zero
Add back @spaces.GPU touch required by ZeroGPU runtime
Browse files
app.py
CHANGED
|
@@ -21,6 +21,19 @@ if hf_token:
|
|
| 21 |
login(token=hf_token)
|
| 22 |
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
def _log(message):
|
| 25 |
print(message.encode("ascii", "backslashreplace").decode("ascii"), flush=True)
|
| 26 |
|
|
|
|
| 21 |
login(token=hf_token)
|
| 22 |
|
| 23 |
|
| 24 |
+
# ZeroGPU Spaces require at least one @spaces.GPU function to be defined
|
| 25 |
+
# during startup. This minimal touch satisfies that requirement.
|
| 26 |
+
@spaces.GPU(duration=1)
|
| 27 |
+
def _gpu_startup_touch():
|
| 28 |
+
return "ok"
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
try:
|
| 32 |
+
_gpu_startup_touch()
|
| 33 |
+
except Exception as e:
|
| 34 |
+
print(f"Warning: ZeroGPU touch failed: {e}", flush=True)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
def _log(message):
|
| 38 |
print(message.encode("ascii", "backslashreplace").decode("ascii"), flush=True)
|
| 39 |
|