Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,14 +21,23 @@ def scan_spaces_detailed(username: str):
|
|
| 21 |
info = api.space_info(space.id, token=HF_TOKEN)
|
| 22 |
status = getattr(info, "status", "unknown")
|
| 23 |
tags = getattr(info, "tags", [])
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
if
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
else:
|
| 30 |
-
# fallback to
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
# Log all metadata
|
| 34 |
output += f"Space: {space.id}\n"
|
|
|
|
| 21 |
info = api.space_info(space.id, token=HF_TOKEN)
|
| 22 |
status = getattr(info, "status", "unknown")
|
| 23 |
tags = getattr(info, "tags", [])
|
| 24 |
+
|
| 25 |
+
# Check runtime requested_hardware
|
| 26 |
+
runtime = getattr(info, "runtime", None)
|
| 27 |
+
if runtime:
|
| 28 |
+
requested_hw = getattr(runtime, "requested_hardware", None)
|
| 29 |
+
# Consider ZeroGPU if requested hardware is "zero-*" (CPU-only)
|
| 30 |
+
if requested_hw and requested_hw.lower().startswith("zero"):
|
| 31 |
+
hardware = "ZeroGPU"
|
| 32 |
+
else:
|
| 33 |
+
hardware = "GPU"
|
| 34 |
else:
|
| 35 |
+
# fallback to old method
|
| 36 |
+
hardware_field = getattr(info, "hardware", None)
|
| 37 |
+
if hardware_field:
|
| 38 |
+
hardware = "ZeroGPU" if all("cpu" in h.lower() for h in hardware_field) else "GPU"
|
| 39 |
+
else:
|
| 40 |
+
hardware = "ZeroGPU" if "cpu" in tags else "GPU"
|
| 41 |
|
| 42 |
# Log all metadata
|
| 43 |
output += f"Space: {space.id}\n"
|