rahul7star commited on
Commit
362cd4e
·
verified ·
1 Parent(s): aee5791

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -7
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
- hardware_field = getattr(info, "hardware", None)
25
-
26
- # Determine ZeroGPU
27
- if hardware_field:
28
- hardware = "ZeroGPU" if all("cpu" in h.lower() for h in hardware_field) else "GPU"
 
 
 
 
 
29
  else:
30
- # fallback to tags
31
- hardware = "ZeroGPU" if "cpu" in tags else "GPU"
 
 
 
 
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"