from huggingface_hub import HfApi | |
def space_hardware() -> str: | |
repo_id = "yxmauw/chatbot" | |
api = HfApi() | |
runtime = api.get_space_runtime(repo_id=repo_id) | |
if runtime.hardware is None: | |
space_hardware = "cpu-basic" | |
else: | |
space_hardware = runtime.hardware | |
first_string = space_hardware.split("-")[0].upper() | |
second_string = space_hardware.split("-")[1] | |
space_hardware = " ".join([first_string, second_string]) | |
return space_hardware | |