Wormeata commited on
Commit
acb5704
·
verified ·
1 Parent(s): f3a8e7b

Deploy BASILISC worker: app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -2
app.py CHANGED
@@ -342,7 +342,37 @@ def _texture_pipeline():
342
  return _TEXTURE_PIPE
343
 
344
 
345
- @spaces.GPU(duration=300)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
  @torch.no_grad()
347
  def basilisc_texture(
348
  mesh_file,
@@ -425,4 +455,4 @@ with gr.Blocks(title="BASILISC Texture Worker") as demo:
425
  )
426
 
427
  if __name__ == "__main__":
428
- demo.queue(default_concurrency_limit=1).launch()
 
342
  return _TEXTURE_PIPE
343
 
344
 
345
+ def _estimate_gpu_duration(
346
+ mesh_file,
347
+ reference_file,
348
+ prompt="high quality",
349
+ seed=42,
350
+ steps=25,
351
+ reference_strength=1.0,
352
+ uv_unwrap=False,
353
+ uv_size=2048,
354
+ ):
355
+ """Reserve only the ZeroGPU time appropriate for the selected preset.
356
+
357
+ Draft is intentionally kept below the current anonymous daily allowance;
358
+ Standard and Final are intended for authenticated Hugging Face users.
359
+ """
360
+ try:
361
+ step_count = int(steps)
362
+ except Exception:
363
+ step_count = 25
364
+ try:
365
+ texture_size = int(uv_size)
366
+ except Exception:
367
+ texture_size = 2048
368
+ if step_count <= 15 and texture_size <= 1024:
369
+ return 115
370
+ if step_count <= 25 and texture_size <= 2048:
371
+ return 210
372
+ return 285
373
+
374
+
375
+ @spaces.GPU(duration=_estimate_gpu_duration)
376
  @torch.no_grad()
377
  def basilisc_texture(
378
  mesh_file,
 
455
  )
456
 
457
  if __name__ == "__main__":
458
+ demo.queue(default_concurrency_limit=1).launch(show_error=True)