Spaces:
Sleeping
Sleeping
File size: 1,378 Bytes
d1bff6b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | from __future__ import annotations
import os
import webbrowser
TOKEN_URLS = {
"HF_TOKEN": "https://huggingface.co/settings/tokens",
"KAGGLE_API_TOKEN": "https://www.kaggle.com/settings/api",
}
REQUIRED_ENV = ["HF_TOKEN", "HF_SPACE_ID", "KAGGLE_USERNAME", "KAGGLE_API_TOKEN"]
def main() -> None:
missing = [name for name in REQUIRED_ENV if not os.environ.get(name)]
print("Mplus Studio deploy check")
print("")
for name in REQUIRED_ENV:
status = "set" if os.environ.get(name) else "missing"
print(f"{name}: {status}")
if not missing:
print("")
print("All required deploy variables are set. Run: npm run deploy:huggingface")
return
print("")
print("Missing variables:")
for name in missing:
print(f"- {name}")
for name in missing:
url = TOKEN_URLS.get(name)
if url is not None:
print(f"Opening {name} setup page: {url}")
webbrowser.open(url)
print("")
print("Set the variables in this PowerShell session, then run deploy again:")
print('$env:HF_TOKEN="hf_..."')
print('$env:HF_SPACE_ID="your-huggingface-name/mplus-studio"')
print('$env:KAGGLE_USERNAME="your-kaggle-username"')
print('$env:KAGGLE_API_TOKEN="your-kaggle-api-token"')
print("npm run deploy:huggingface")
if __name__ == "__main__":
main()
|