linoyts HF Staff commited on
Commit
4286da6
·
verified ·
1 Parent(s): 0e22122

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +21 -3
app.py CHANGED
@@ -44,6 +44,11 @@ AOTI_REPO = os.environ.get("F3_AOTI_REPO", "diffusers-modular/f3-small-image-dis
44
  AOTI_ENABLED = os.environ.get("F3_AOTI", "1") != "0"
45
  HF_TOKEN = os.environ.get("HF_TOKEN")
46
 
 
 
 
 
 
47
  MAX_SEED = 2**63 - 1
48
  DEFAULT_STEPS = int(os.environ.get("F3_STEPS", "16")) # distilled default
49
 
@@ -375,6 +380,7 @@ RATIO_LIST = list(RATIOS.keys())
375
  CONFIG_JS = (
376
  "<script>window.F3_PRESETS = " + json.dumps(PRESETS) + ";"
377
  "window.F3_RATIOS = " + json.dumps(RATIO_LIST) + ";"
 
378
  "window.F3_PRESET_ORDER = " + json.dumps(list(PRESETS.keys())) + ";</script>"
379
  )
380
 
@@ -500,9 +506,15 @@ STYLE2 = """
500
  #f3-root .box.sel .h{border-color:var(--green);}
501
 
502
  /* title */
503
- #f3-root .titlebar{margin:0 0 16px;}
 
504
  #f3-root .titlebar h1{margin:0 0 4px;font-size:22px;font-weight:650;color:var(--txt);letter-spacing:-.01em;}
505
  #f3-root .titlebar p{margin:0;color:var(--dim);font-size:13.5px;max-width:760px;line-height:1.5;}
 
 
 
 
 
506
 
507
  /* reference image block (i2i) */
508
  #f3-root .refblock{padding:14px 18px;border-bottom:1px solid var(--line2);}
@@ -882,9 +894,15 @@ SCRIPT = r"""
882
  function build(root){
883
  const order=window.F3_PRESET_ORDER||Object.keys(window.F3_PRESETS||{});
884
  root.innerHTML=''
885
- +'<div class="titlebar"><h1>🦊 FLUX.3 Layout Canvas</h1>'
886
- + '<p>Draw a box for every element, describe it, and the step-distilled FLUX.3 model renders your layout. '
 
887
  + 'Upload a reference image to edit it with the same boxes.</p></div>'
 
 
 
 
 
888
  // INPUT BAR — the type-here / drop-here controls, in their own distinct zone above the canvas
889
  +'<div class="inputbar">'
890
  + '<div class="ib-ref">'
 
44
  AOTI_ENABLED = os.environ.get("F3_AOTI", "1") != "0"
45
  HF_TOKEN = os.environ.get("HF_TOKEN")
46
 
47
+ # Header "button" links (klein-style pills). Point at the model cards; override via env
48
+ # when switching to the public klein repos.
49
+ LINK_DISTILLED = os.environ.get("F3_LINK_DISTILLED", "https://huggingface.co/black-forest-labs/flux-3-image-klein")
50
+ LINK_BASE = os.environ.get("F3_LINK_BASE", "https://huggingface.co/black-forest-labs/flux-3-image-klein-base")
51
+
52
  MAX_SEED = 2**63 - 1
53
  DEFAULT_STEPS = int(os.environ.get("F3_STEPS", "16")) # distilled default
54
 
 
380
  CONFIG_JS = (
381
  "<script>window.F3_PRESETS = " + json.dumps(PRESETS) + ";"
382
  "window.F3_RATIOS = " + json.dumps(RATIO_LIST) + ";"
383
+ "window.F3_LINKS = " + json.dumps({"distilled": LINK_DISTILLED, "base": LINK_BASE}) + ";"
384
  "window.F3_PRESET_ORDER = " + json.dumps(list(PRESETS.keys())) + ";</script>"
385
  )
386
 
 
506
  #f3-root .box.sel .h{border-color:var(--green);}
507
 
508
  /* title */
509
+ #f3-root .titlebar{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:0 0 16px;}
510
+ #f3-root .titlebar .tb-text{min-width:0;}
511
  #f3-root .titlebar h1{margin:0 0 4px;font-size:22px;font-weight:650;color:var(--txt);letter-spacing:-.01em;}
512
  #f3-root .titlebar p{margin:0;color:var(--dim);font-size:13.5px;max-width:760px;line-height:1.5;}
513
+ /* klein-style pill links */
514
+ #f3-root .f3-links{display:flex;gap:8px;flex-wrap:wrap;}
515
+ #f3-root .f3-links a,#f3-root .f3-links a:visited{text-decoration:none;font-size:12.5px;padding:6px 13px;border-radius:999px;
516
+ border:1px solid var(--line2);color:var(--txt);background:var(--panel);white-space:nowrap;transition:border-color .12s,color .12s;}
517
+ #f3-root .f3-links a:hover{border-color:var(--violet);color:var(--violet);}
518
 
519
  /* reference image block (i2i) */
520
  #f3-root .refblock{padding:14px 18px;border-bottom:1px solid var(--line2);}
 
894
  function build(root){
895
  const order=window.F3_PRESET_ORDER||Object.keys(window.F3_PRESETS||{});
896
  root.innerHTML=''
897
+ +'<div class="titlebar">'
898
+ + '<div class="tb-text"><h1>🦊 FLUX.3 Layout Canvas</h1>'
899
+ + '<p>Draw a box for every element, describe it, and the step-distilled FLUX.3 model renders your layout. '
900
  + 'Upload a reference image to edit it with the same boxes.</p></div>'
901
+ + '<div class="f3-links">'
902
+ + '<a href="'+((window.F3_LINKS||{}).distilled||'#')+'" target="_blank" rel="noopener">Distilled model ↗</a>'
903
+ + '<a href="'+((window.F3_LINKS||{}).base||'#')+'" target="_blank" rel="noopener">Base model ↗</a>'
904
+ + '</div>'
905
+ +'</div>'
906
  // INPUT BAR — the type-here / drop-here controls, in their own distinct zone above the canvas
907
  +'<div class="inputbar">'
908
  + '<div class="ib-ref">'