Download common/singleton.py from hhz520/webchat: direct link, hf CLI and curl.
- Browser
- Download file 217 Bytes
-
https://huggingface.co/spaces/hhz520/webchat/resolve/main/common/singleton.py
- Command line
-
hf download hf://spaces/hhz520/webchat/common/singleton.py
-
curl -L -o singleton.py https://huggingface.co/spaces/hhz520/webchat/resolve/main/common/singleton.py
217 Bytes
| def singleton(cls): | |
| instances = {} | |
| def get_instance(*args, **kwargs): | |
| if cls not in instances: | |
| instances[cls] = cls(*args, **kwargs) | |
| return instances[cls] | |
| return get_instance | |