akhaliq HF Staff commited on
Commit
a03bf38
·
1 Parent(s): e56371b
Files changed (1) hide show
  1. backend_deploy.py +11 -11
backend_deploy.py CHANGED
@@ -1196,25 +1196,25 @@ def duplicate_space_to_user(
1196
  print(f"[Duplicate] Duplicating {from_space_id} to {to_space_id}")
1197
 
1198
  # Prepare duplicate_space parameters
 
 
 
1199
  duplicate_params = {
1200
  "from_id": from_space_id,
1201
  "to_id": to_space_name, # Just the name, not full ID
1202
  "token": token,
1203
- "private": private,
1204
  "exist_ok": True
 
 
1205
  }
1206
 
1207
- # Always use the same hardware as the original space if it has one
1208
- if original_hardware:
1209
- duplicate_params["hardware"] = original_hardware
1210
- print(f"[Duplicate] Using same hardware as original: {original_hardware}")
1211
 
1212
- if original_storage:
1213
- duplicate_params["storage"] = original_storage
1214
- print(f"[Duplicate] Using same storage as original: {original_storage}")
1215
-
1216
- # Duplicate the space
1217
- print(f"[Duplicate] Duplicating with params: {list(duplicate_params.keys())}")
1218
  duplicated_repo = duplicate_space(**duplicate_params)
1219
 
1220
  # Extract space URL
 
1196
  print(f"[Duplicate] Duplicating {from_space_id} to {to_space_id}")
1197
 
1198
  # Prepare duplicate_space parameters
1199
+ # Per docs: "The new Space will be created in your account and will be in the same
1200
+ # state as the original Space (running or paused)"
1201
+ # Don't specify hardware/storage - let HuggingFace duplicate automatically
1202
  duplicate_params = {
1203
  "from_id": from_space_id,
1204
  "to_id": to_space_name, # Just the name, not full ID
1205
  "token": token,
 
1206
  "exist_ok": True
1207
+ # Note: Not setting private, hardware, storage, secrets, variables
1208
+ # to ensure TRUE duplication (HF copies everything automatically)
1209
  }
1210
 
1211
+ # Only set private if explicitly requested
1212
+ if private:
1213
+ duplicate_params["private"] = private
 
1214
 
1215
+ # Duplicate the space (HuggingFace automatically copies all settings)
1216
+ print(f"[Duplicate] Duplicating {from_space_id} to {username}/{to_space_name}")
1217
+ print(f"[Duplicate] Letting HuggingFace handle hardware/storage/secrets automatically")
 
 
 
1218
  duplicated_repo = duplicate_space(**duplicate_params)
1219
 
1220
  # Extract space URL