burtenshaw commited on
Commit
2e26099
·
1 Parent(s): c2b7d57

hash space ids

Browse files
.claude/skills/hf-space-sandbox/scripts/sandbox.py CHANGED
@@ -26,6 +26,7 @@ import argparse
26
  import os
27
  import sys
28
  import time
 
29
 
30
  from huggingface_hub import HfApi, SpaceHardware
31
 
@@ -52,10 +53,11 @@ def cmd_create(args):
52
  hw = args.hardware or "cpu-basic"
53
  source = args.source or TEMPLATE_SPACE
54
 
55
- print(f"Duplicating {source} to {args.space_id}...")
 
56
  kwargs = {
57
  "from_id": source,
58
- "to_id": args.space_id,
59
  "private": args.private,
60
  "hardware": hw,
61
  }
 
26
  import os
27
  import sys
28
  import time
29
+ import uuid
30
 
31
  from huggingface_hub import HfApi, SpaceHardware
32
 
 
53
  hw = args.hardware or "cpu-basic"
54
  source = args.source or TEMPLATE_SPACE
55
 
56
+ space_id = f"{args.space_id.replace('/', '-')}-sandbox-{uuid.uuid4().hex}"
57
+ print(f"Duplicating {source} to {space_id}...")
58
  kwargs = {
59
  "from_id": source,
60
+ "to_id": space_id,
61
  "private": args.private,
62
  "hardware": hw,
63
  }