Supra-Tex / hf_space /gpu_mode.py
UniLat3D's picture
Synchronize production exactly with verified ZeroGPU Test Space
f3948d0 verified
Raw History Blame Contribute Delete
498 Bytes
"""Hardware mode without importing Torch or starting a GPU runtime."""
import os
def enabled():
return os.environ.get('SPACES_ZERO_GPU', '').lower() in ('1', 'true', 't')
def pending_fields(operations):
if not enabled():
return {}
pending = next((op for op in operations if op.get('status') == 'queued'), None)
return {'gpu_mode': 'zerogpu', 'gpu_operation_id': pending['id'] if pending else None,
'gpu_operation_kind': pending['kind'] if pending else None}