Spaces:
Runtime error
Runtime error
Download src/core/singleton.py from TYH71/CLIP-Gradio-Demo: direct link, hf CLI and curl.
- Browser
- Download file 345 Bytes
-
https://huggingface.co/spaces/TYH71/CLIP-Gradio-Demo/resolve/main/src/core/singleton.py
- Command line
-
hf download hf://spaces/TYH71/CLIP-Gradio-Demo/src/core/singleton.py
-
curl -L -o singleton.py https://huggingface.co/spaces/TYH71/CLIP-Gradio-Demo/resolve/main/src/core/singleton.py
345 Bytes
| """script to implement singleton design pattern""" | |
| class SingletonMeta(type): | |
| """Singleton Metaclass""" | |
| _instances = {} | |
| def __call__(cls, *args, **kwargs): | |
| if cls not in cls._instances: | |
| instance = super().__call__(*args, **kwargs) | |
| cls._instances[cls] = instance | |
| return cls._instances[cls] | |