Spaces:
Running
Running
Adding more stuff from other files into this single file.
Browse files
app.py
CHANGED
@@ -13,6 +13,35 @@ TOKEN = os.environ.get("DEBUG")
|
|
13 |
API = HfApi(token=TOKEN)
|
14 |
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
def update(name):
|
17 |
API.restart_space(COMPUTE_SPACE)
|
18 |
return f"Okay! {COMPUTE_SPACE} should be running now!"
|
|
|
13 |
API = HfApi(token=TOKEN)
|
14 |
|
15 |
|
16 |
+
## All the model information that we might need
|
17 |
+
@dataclass
|
18 |
+
class ModelDetails:
|
19 |
+
name: str
|
20 |
+
display_name: str = ""
|
21 |
+
symbol: str = "" # emoji
|
22 |
+
|
23 |
+
class ModelType(Enum):
|
24 |
+
PT = ModelDetails(name="pretrained", symbol="π’")
|
25 |
+
FT = ModelDetails(name="fine-tuned", symbol="πΆ")
|
26 |
+
IFT = ModelDetails(name="instruction-tuned", symbol="β")
|
27 |
+
RL = ModelDetails(name="RL-tuned", symbol="π¦")
|
28 |
+
Unknown = ModelDetails(name="", symbol="?")
|
29 |
+
|
30 |
+
def to_str(self, separator=" "):
|
31 |
+
return f"{self.value.symbol}{separator}{self.value.name}"
|
32 |
+
|
33 |
+
@staticmethod
|
34 |
+
def from_str(type):
|
35 |
+
if "fine-tuned" in type or "πΆ" in type:
|
36 |
+
return ModelType.FT
|
37 |
+
if "pretrained" in type or "π’" in type:
|
38 |
+
return ModelType.PT
|
39 |
+
if "RL-tuned" in type or "π¦" in type:
|
40 |
+
return ModelType.RL
|
41 |
+
if "instruction-tuned" in type or "β" in type:
|
42 |
+
return ModelType.IFT
|
43 |
+
return ModelType.Unknown
|
44 |
+
|
45 |
def update(name):
|
46 |
API.restart_space(COMPUTE_SPACE)
|
47 |
return f"Okay! {COMPUTE_SPACE} should be running now!"
|