from huggingface_hub import HfApi | |
from dotenv import load_dotenv | |
import os | |
load_dotenv() | |
# Replace with your actual token and space details | |
HF_TOKEN = os.environ.get("HF_TOKEN") | |
REPO_ID = "zqu2004/Test" | |
# Initialize the API client | |
api = HfApi(token=HF_TOKEN) | |
# Restart the Space | |
api.restart_space(repo_id=REPO_ID) | |
print("Space restarted successfully.") |