CyberWaifu commited on
Commit
7a608c8
·
verified ·
1 Parent(s): 9584187

Sking image-to-Minecraft-skin pipeline (AGPL-3.0)

Browse files

Two-stage reproduction of EntropyDrop's open image-to-skin path.

stage 1 FLUX.2 [klein] 4B Base + sking_v73_flux_4b_000027000 LoRA
stage 2 EntropyDrop SKING_DDJ_v104 (BiRefNet foreground + Dense UV Parser)

Stage 2 runs in-process via runpy rather than subprocess so it works on
ZeroGPU, where child processes get no CUDA context. Dependency pins are
deviated from the bundle's tested_environments.json in three places to keep
the resolver satisfiable alongside diffusers==0.40.0; see DEPLOY.md.

Files changed (1) hide show
  1. app.py +36 -12
app.py CHANGED
@@ -328,7 +328,14 @@ Not affiliated with or endorsed by EntropyDrop, Mojang or Microsoft.
328
  Uploads are processed in memory and are not stored or used for training.
329
  """
330
 
331
- with gr.Blocks(title="Sking — Image to Minecraft Skin") as demo:
 
 
 
 
 
 
 
332
  gr.Markdown(
333
  """
334
  # Sking · image → Minecraft skin
@@ -430,21 +437,38 @@ print(f"[sking] spaces.GPU resolved to {gpu(1)!r}", flush=True)
430
 
431
 
432
  def _launch() -> None:
433
- """Bind 7860 immediately; the ~19 GB download continues in the background."""
 
 
 
 
 
 
 
434
  print("[sking] calling demo.launch()", flush=True)
435
- common = dict(server_name="0.0.0.0", server_port=7860, show_api=False)
436
  try:
437
  demo.queue(default_concurrency_limit=1)
438
  except TypeError:
439
- # kwarg renamed/removed across Gradio majors; default queueing is fine.
440
- demo.queue()
441
- try:
442
- # Gradio 6 moved css/theme from the Blocks constructor to launch().
443
- demo.launch(theme=gr.themes.Soft(), css=_CSS, **common)
444
- except TypeError:
445
- # Gradio <=5 still takes them on Blocks / rejects them on launch().
446
- demo.launch(**common)
447
- print("[sking] demo.launch() returned", flush=True)
 
 
 
 
 
 
 
 
 
 
 
448
 
449
 
450
  # Deliberately NOT guarded by `if __name__ == "__main__"`: launching
 
328
  Uploads are processed in memory and are not stored or used for training.
329
  """
330
 
331
+ try:
332
+ _blocks_ctx = gr.Blocks(
333
+ title="Sking — Image to Minecraft Skin", theme=gr.themes.Soft(), css=_CSS
334
+ )
335
+ except TypeError:
336
+ _blocks_ctx = gr.Blocks(title="Sking — Image to Minecraft Skin")
337
+
338
+ with _blocks_ctx as demo:
339
  gr.Markdown(
340
  """
341
  # Sking · image → Minecraft skin
 
437
 
438
 
439
  def _launch() -> None:
440
+ """Bind 7860 immediately; the ~19 GB download continues in the background.
441
+
442
+ `spaces` monkeypatches `gr.Blocks.launch` (spaces/zero/gradio.py) and simply
443
+ forwards *args/**kwargs, so a kwarg Gradio 6.27 dropped -- `show_api` -- or
444
+ one it relocated -- `theme`/`css` -- becomes a fatal TypeError at startup.
445
+ Walk from richest to the bare minimum instead of guessing the signature;
446
+ every rejected attempt fails before binding, so retrying is safe.
447
+ """
448
  print("[sking] calling demo.launch()", flush=True)
 
449
  try:
450
  demo.queue(default_concurrency_limit=1)
451
  except TypeError:
452
+ demo.queue() # kwarg renamed/removed across Gradio majors
453
+
454
+ base = dict(server_name="0.0.0.0", server_port=7860)
455
+ attempts = [
456
+ {**base, "show_api": False, "theme": gr.themes.Soft(), "css": _CSS},
457
+ {**base, "theme": gr.themes.Soft(), "css": _CSS},
458
+ {**base, "show_api": False},
459
+ dict(base),
460
+ ]
461
+ last = None
462
+ for kwargs in attempts:
463
+ try:
464
+ demo.launch(**kwargs)
465
+ print(f"[sking] demo.launch() returned (accepted "
466
+ f"{sorted(kwargs)})", flush=True)
467
+ return
468
+ except TypeError as exc:
469
+ last = exc
470
+ print(f"[sking] launch rejected {sorted(kwargs)}: {exc}", flush=True)
471
+ raise last
472
 
473
 
474
  # Deliberately NOT guarded by `if __name__ == "__main__"`: launching