tao-shen Claude Opus 4.6 commited on
Commit
be27e2d
Β·
1 Parent(s): 5c21155

fix: specify cpu-basic hardware when duplicating Space for child creation

Browse files

HF API requires hardware parameter when duplicating Spaces.
Also use hf_api.duplicate_space() instead of deprecated top-level function.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. scripts/conversation-loop.py +3 -2
scripts/conversation-loop.py CHANGED
@@ -58,7 +58,7 @@ print(f"[init] Zhipu key: {ZHIPU_KEY[:8]}...{ZHIPU_KEY[-4:]}")
58
  print(f"[init] HF token: {HF_TOKEN[:8]}...{HF_TOKEN[-4:]}")
59
 
60
  # ── HuggingFace API ────────────────────────────────────────────────────────────
61
- from huggingface_hub import HfApi, duplicate_space, create_repo
62
  hf_api = HfApi(token=HF_TOKEN)
63
 
64
  # ══════════════════════════════════════════════════════════════════════════════
@@ -125,12 +125,13 @@ def create_child_space():
125
 
126
  # 3. Duplicate Space from Adam
127
  print(f"[birth] Duplicating {SOURCE_SPACE_ID} β†’ {CHILD_SPACE_ID}")
128
- duplicate_space(
129
  from_id=SOURCE_SPACE_ID,
130
  to_id=CHILD_SPACE_ID,
131
  token=HF_TOKEN,
132
  exist_ok=True,
133
  private=False,
 
134
  )
135
  print(f"[birth] Space duplicated")
136
 
 
58
  print(f"[init] HF token: {HF_TOKEN[:8]}...{HF_TOKEN[-4:]}")
59
 
60
  # ── HuggingFace API ────────────────────────────────────────────────────────────
61
+ from huggingface_hub import HfApi, create_repo
62
  hf_api = HfApi(token=HF_TOKEN)
63
 
64
  # ══════════════════════════════════════════════════════════════════════════════
 
125
 
126
  # 3. Duplicate Space from Adam
127
  print(f"[birth] Duplicating {SOURCE_SPACE_ID} β†’ {CHILD_SPACE_ID}")
128
+ hf_api.duplicate_space(
129
  from_id=SOURCE_SPACE_ID,
130
  to_id=CHILD_SPACE_ID,
131
  token=HF_TOKEN,
132
  exist_ok=True,
133
  private=False,
134
+ hardware="cpu-basic",
135
  )
136
  print(f"[birth] Space duplicated")
137