Spaces:
Running on Zero
Running on Zero
File size: 1,457 Bytes
7f9dfed | 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 52 | from __future__ import annotations
import argparse
import shutil
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from deployment.hf_space import ( # noqa: E402
create_space_commands,
hackathon_space_commands,
space_build_status,
)
def main() -> None:
parser = argparse.ArgumentParser(description="Plan Hugging Face Space deployment")
parser.add_argument("--user", required=True, help="Hugging Face user or org")
parser.add_argument("--space", default="openbmb-local-ai-workbench")
parser.add_argument("--branch", default="main")
args = parser.parse_args()
git_executable = shutil.which("git") or "git"
remote_output = subprocess.run( # noqa: S603
[git_executable, "remote", "-v"],
check=False,
capture_output=True,
text=True,
).stdout
status = space_build_status(".", remote_output)
print("Space build status:")
print(status.as_dict())
print("\nCommands to run manually:")
for command in create_space_commands(args.user, args.space, args.branch):
print(f"- {command}")
print("\nBuild Small Hackathon target Spaces:")
for name, commands in hackathon_space_commands(args.branch).items():
print(f"\n{name}:")
for command in commands:
print(f"- {command}")
if __name__ == "__main__":
main()
|