Create config.py
Browse files
config.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from huggingface_hub import HfApi
|
2 |
+
|
3 |
+
def space_hardware() -> str:
|
4 |
+
repo_id = "yxmauw/chatbot"
|
5 |
+
api = HfApi()
|
6 |
+
runtime = api.get_space_runtime(repo_id=repo_id)
|
7 |
+
if runtime.hardware is None:
|
8 |
+
space_hardware = "cpu-basic"
|
9 |
+
else:
|
10 |
+
space_hardware = runtime.hardware
|
11 |
+
first_string = space_hardware.split("-")[0].upper()
|
12 |
+
second_string = space_hardware.split("-")[1]
|
13 |
+
space_hardware = " ".join([first_string, second_string])
|
14 |
+
return space_hardware
|