Upload utils.py with huggingface_hub
Browse files
utils.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import abc
|
2 |
+
|
3 |
+
class Singleton(abc.ABC):
|
4 |
+
_instances = {}
|
5 |
+
|
6 |
+
def __new__(cls, *args, **kwargs):
|
7 |
+
if cls not in cls._instances:
|
8 |
+
cls._instances[cls] = super(Singleton, cls).__new__(cls)
|
9 |
+
return cls._instances[cls]
|
10 |
+
|
11 |
+
|