Spaces:
Runtime error
Runtime error
Fix ZeroGPU command center callback
Browse files
app.py
CHANGED
|
@@ -44,6 +44,14 @@ DEFAULT_PROMPT = (
|
|
| 44 |
MODEL_RELAY = WeaverModelRelay()
|
| 45 |
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
def _relay_snapshot(adult_mode: bool = False) -> dict[str, Any]:
|
| 48 |
return MODEL_RELAY.dashboard_snapshot(public_demo=not adult_mode)
|
| 49 |
|
|
@@ -75,6 +83,7 @@ def _dashboard_regions(
|
|
| 75 |
)
|
| 76 |
|
| 77 |
|
|
|
|
| 78 |
def run_weave(
|
| 79 |
prompt: str,
|
| 80 |
reasoning_mode: str,
|
|
|
|
| 44 |
MODEL_RELAY = WeaverModelRelay()
|
| 45 |
|
| 46 |
|
| 47 |
+
def _zero_gpu_entrypoint(fn: Any) -> Any:
|
| 48 |
+
"""Expose one callback to ZeroGPU without making local development depend on Spaces."""
|
| 49 |
+
gpu_decorator = getattr(spaces, "GPU", None) if spaces is not None else None
|
| 50 |
+
if gpu_decorator is None:
|
| 51 |
+
return fn
|
| 52 |
+
return gpu_decorator(duration=30)(fn)
|
| 53 |
+
|
| 54 |
+
|
| 55 |
def _relay_snapshot(adult_mode: bool = False) -> dict[str, Any]:
|
| 56 |
return MODEL_RELAY.dashboard_snapshot(public_demo=not adult_mode)
|
| 57 |
|
|
|
|
| 83 |
)
|
| 84 |
|
| 85 |
|
| 86 |
+
@_zero_gpu_entrypoint
|
| 87 |
def run_weave(
|
| 88 |
prompt: str,
|
| 89 |
reasoning_mode: str,
|