PlanExe / src /utils /is_huggingface_spaces.py
Simon Strandgaard
Extracted is_huggingface_spaces() function
a145e10
raw
history blame
332 Bytes
"""
PROMPT> IS_HUGGINGFACE_SPACES=true python -m src.utils.is_huggingface_spaces
True
PROMPT> python -m src.utils.is_huggingface_spaces
False
"""
import os
def is_huggingface_spaces() -> bool:
return os.getenv("IS_HUGGINGFACE_SPACES", "false").lower() == "true"
if __name__ == "__main__":
print(is_huggingface_spaces())