BoxOfColors Claude Sonnet 4.6 commited on
Commit
2fdad19
·
1 Parent(s): 0224191

fix: add gr.Request to xregen_* for proper ZeroGPU quota attribution

Browse files

Gradio automatically injects gr.Request into the server-side handler
when the function signature includes it. This gives @spaces.GPU access
to the user's auth token via the request context, so ZeroGPU attributes
GPU usage to the logged-in Pro account instead of the anonymous pool.

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

Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1358,7 +1358,8 @@ def _resample_to_slot_sr(wav: np.ndarray, src_sr: int, dst_sr: int,
1358
 
1359
  def xregen_taro(seg_idx, state_json, slot_id,
1360
  seed_val, cfg_scale, num_steps, mode,
1361
- crossfade_s, crossfade_db):
 
1362
  """Cross-model regen: run TARO inference and splice into *slot_id*."""
1363
  meta = json.loads(state_json)
1364
  seg_idx = int(seg_idx)
@@ -1381,7 +1382,8 @@ def xregen_taro(seg_idx, state_json, slot_id,
1381
 
1382
  def xregen_mmaudio(seg_idx, state_json, slot_id,
1383
  prompt, negative_prompt, seed_val,
1384
- cfg_strength, num_steps, crossfade_s, crossfade_db):
 
1385
  """Cross-model regen: run MMAudio inference and splice into *slot_id*."""
1386
  meta = json.loads(state_json)
1387
  seg_idx = int(seg_idx)
@@ -1416,7 +1418,8 @@ def xregen_mmaudio(seg_idx, state_json, slot_id,
1416
  def xregen_hunyuan(seg_idx, state_json, slot_id,
1417
  prompt, negative_prompt, seed_val,
1418
  guidance_scale, num_steps, model_size,
1419
- crossfade_s, crossfade_db):
 
1420
  """Cross-model regen: run HunyuanFoley inference and splice into *slot_id*."""
1421
  meta = json.loads(state_json)
1422
  seg_idx = int(seg_idx)
 
1358
 
1359
  def xregen_taro(seg_idx, state_json, slot_id,
1360
  seed_val, cfg_scale, num_steps, mode,
1361
+ crossfade_s, crossfade_db,
1362
+ request: gr.Request = None):
1363
  """Cross-model regen: run TARO inference and splice into *slot_id*."""
1364
  meta = json.loads(state_json)
1365
  seg_idx = int(seg_idx)
 
1382
 
1383
  def xregen_mmaudio(seg_idx, state_json, slot_id,
1384
  prompt, negative_prompt, seed_val,
1385
+ cfg_strength, num_steps, crossfade_s, crossfade_db,
1386
+ request: gr.Request = None):
1387
  """Cross-model regen: run MMAudio inference and splice into *slot_id*."""
1388
  meta = json.loads(state_json)
1389
  seg_idx = int(seg_idx)
 
1418
  def xregen_hunyuan(seg_idx, state_json, slot_id,
1419
  prompt, negative_prompt, seed_val,
1420
  guidance_scale, num_steps, model_size,
1421
+ crossfade_s, crossfade_db,
1422
+ request: gr.Request = None):
1423
  """Cross-model regen: run HunyuanFoley inference and splice into *slot_id*."""
1424
  meta = json.loads(state_json)
1425
  seg_idx = int(seg_idx)