Spaces:
Sleeping
Sleeping
File size: 1,226 Bytes
a42d9ad | 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 | """Create the private Docker Space and upload this deployment source tree."""
import argparse
from pathlib import Path
from huggingface_hub import HfApi, Volume
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--repo", default="Angshul/Tensor-Pruning-API")
parser.add_argument("--model-repo", help="Optionally mount a model repo read-only at /models")
args = parser.parse_args()
api = HfApi()
options = {}
if args.model_repo:
options["space_volumes"] = [
Volume(type="model", source=args.model_repo, mount_path="/models", read_only=True)
]
api.create_repo(args.repo, repo_type="space", space_sdk="docker", private=True, **options)
api.upload_folder(repo_id=args.repo, repo_type="space", folder_path=Path(__file__).parent,
allow_patterns=["README.md", "Dockerfile", "space_app.py",
"pyproject.toml", "tensor_pruning/*.py",
"tensor_pruning/kernel.cpp"],
commit_message="Deploy the CPU tensor-pruning API")
print(f"https://huggingface.co/spaces/{args.repo}")
if __name__ == "__main__":
main()
|