Spaces:
Running on Zero
Running on Zero
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -123,7 +123,7 @@ def _out_dir() -> Path:
|
|
| 123 |
return path
|
| 124 |
|
| 125 |
|
| 126 |
-
@spaces.GPU(duration=
|
| 127 |
def _run_image(img: np.ndarray, f_px: float | None) -> dict:
|
| 128 |
"""DepthPro2-L on one photo already downscaled; returns host arrays and stats."""
|
| 129 |
started = time.perf_counter()
|
|
@@ -190,7 +190,9 @@ def _video_duration(video, *args, **kwargs):
|
|
| 190 |
frames = _probe_frames(_as_path(video) or "")
|
| 191 |
except Exception:
|
| 192 |
frames = MAX_VIDEO_FRAMES
|
| 193 |
-
|
|
|
|
|
|
|
| 194 |
|
| 195 |
|
| 196 |
def _probe_frames(path: str) -> int:
|
|
|
|
| 123 |
return path
|
| 124 |
|
| 125 |
|
| 126 |
+
@spaces.GPU(duration=25)
|
| 127 |
def _run_image(img: np.ndarray, f_px: float | None) -> dict:
|
| 128 |
"""DepthPro2-L on one photo already downscaled; returns host arrays and stats."""
|
| 129 |
started = time.perf_counter()
|
|
|
|
| 190 |
frames = _probe_frames(_as_path(video) or "")
|
| 191 |
except Exception:
|
| 192 |
frames = MAX_VIDEO_FRAMES
|
| 193 |
+
# Measured on ZeroGPU: ~10 s on GPU for a 61-frame 960 px clip (warm); the constant
|
| 194 |
+
# covers cold-start weight streaming and heavier decodes, the slope the per-frame cost.
|
| 195 |
+
return min(120, 30 + int(frames * 0.4))
|
| 196 |
|
| 197 |
|
| 198 |
def _probe_frames(path: str) -> int:
|