TrungTran commited on
Commit
c8599c1
·
verified ·
1 Parent(s): ceb527c

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -190,7 +190,7 @@ def _draw_results(pil_img: Image.Image, results: list[dict]) -> Image.Image:
190
  for i, r in enumerate(results):
191
  color = _PALETTE[i % len(_PALETTE)]
192
  bbox = r.get("bbox")
193
- label = f"{r['gender']} {r['age']:.0f} y"
194
 
195
  if bbox:
196
  x0, y0, x1, y1 = bbox
@@ -204,7 +204,7 @@ def _draw_results(pil_img: Image.Image, results: list[dict]) -> Image.Image:
204
  draw.text((lx0 + 5, ly0 + 2), label, fill="white", font=font_lg)
205
  else:
206
  # Full-image fallback — overlay in top-left corner
207
- full_label = f"{r['gender']} {r['age']:.0f} y ({r['conf']:.0%})"
208
  tw = int(draw.textlength(full_label, font=font_lg))
209
  draw.rectangle([8, 8, tw + 18, 38], fill=color)
210
  draw.text((13, 10), full_label, fill="white", font=font_lg)
@@ -305,7 +305,7 @@ with gr.Blocks(title="FaceAge-DINOv3", theme=gr.themes.Soft()) as demo:
305
 
306
  gr.Markdown("""
307
  ---
308
- *Our Collection: 4M images *
309
  *DINOv3-ViT-L pretrained by Meta AI on LVD-1.68B images.*
310
  """)
311
 
 
190
  for i, r in enumerate(results):
191
  color = _PALETTE[i % len(_PALETTE)]
192
  bbox = r.get("bbox")
193
+ label = f"{r['gender']} {r['age']:.1f} y"
194
 
195
  if bbox:
196
  x0, y0, x1, y1 = bbox
 
204
  draw.text((lx0 + 5, ly0 + 2), label, fill="white", font=font_lg)
205
  else:
206
  # Full-image fallback — overlay in top-left corner
207
+ full_label = f"{r['gender']} {r['age']:.1f} y ({r['conf']:.0%})"
208
  tw = int(draw.textlength(full_label, font=font_lg))
209
  draw.rectangle([8, 8, tw + 18, 38], fill=color)
210
  draw.text((13, 10), full_label, fill="white", font=font_lg)
 
305
 
306
  gr.Markdown("""
307
  ---
308
+ *Our Collection: 4M Images.*
309
  *DINOv3-ViT-L pretrained by Meta AI on LVD-1.68B images.*
310
  """)
311