Daankular commited on
Commit
c604238
Β·
1 Parent(s): 51cdda6

Increase apply_texture GPU duration to 600s; use 512px UV in CPU fallback

Browse files

CPU xatlas texture bake takes ~5-10 min for a dense mesh, exceeding the
old duration=300 limit and causing GPU task abort. Also reduce fallback
uv_size from 1024 to 512 to halve bake time (~4x fewer texels).

Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -1024,7 +1024,7 @@ def _bake_texture_cpu(glb_path: str, mv_views: list, out_path: str,
1024
 
1025
  # ── Stage 2: Texture ──────────────────────────────────────────────────────────
1026
 
1027
- @spaces.GPU(duration=300)
1028
  def apply_texture(glb_path, input_image, remove_background, variant, tex_seed,
1029
  enhance_face, rembg_threshold=0.5, rembg_erode=2,
1030
  progress=gr.Progress()):
@@ -1189,7 +1189,7 @@ def apply_texture(glb_path, input_image, remove_background, variant, tex_seed,
1189
  # Fallback: CPU xatlas UV-unwrap + per-face numpy projection
1190
  print(f"[apply_texture] nvdiffrast baking failed ({type(_nv_err).__name__}): {_nv_err}")
1191
  print("[apply_texture] Falling back to CPU xatlas texture bake...")
1192
- _bake_texture_cpu(glb_path, mv_views, out_glb)
1193
 
1194
  final_path = "/tmp/triposg_textured.glb"
1195
  shutil.copy(out_glb, final_path)
 
1024
 
1025
  # ── Stage 2: Texture ──────────────────────────────────────────────────────────
1026
 
1027
+ @spaces.GPU(duration=600)
1028
  def apply_texture(glb_path, input_image, remove_background, variant, tex_seed,
1029
  enhance_face, rembg_threshold=0.5, rembg_erode=2,
1030
  progress=gr.Progress()):
 
1189
  # Fallback: CPU xatlas UV-unwrap + per-face numpy projection
1190
  print(f"[apply_texture] nvdiffrast baking failed ({type(_nv_err).__name__}): {_nv_err}")
1191
  print("[apply_texture] Falling back to CPU xatlas texture bake...")
1192
+ _bake_texture_cpu(glb_path, mv_views, out_glb, uv_size=512)
1193
 
1194
  final_path = "/tmp/triposg_textured.glb"
1195
  shutil.copy(out_glb, final_path)