multimodalart HF Staff commited on
Commit
3c26dac
·
verified ·
1 Parent(s): c977cd1

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +40 -4
app.py CHANGED
@@ -375,6 +375,11 @@ CSS = """
375
  margin-bottom: 0px;
376
  gap: 8px;
377
  }
 
 
 
 
 
378
  .gnm-group-title {
379
  font-weight: 600;
380
  font-size: 0.95rem;
@@ -412,7 +417,7 @@ CSS = """
412
  flex-direction: column;
413
  align-items: center;
414
  width: 50px;
415
- padding: 4px 0px 2px 0px;
416
  user-select: none;
417
  -webkit-user-select: none;
418
  box-sizing: border-box;
@@ -732,8 +737,7 @@ with gr.Blocks(title="GNM Head") as demo:
732
  return _build_expr
733
 
734
  # Place the "Left eye" and "Right eye" groups side by
735
- # side in a single row; render the remaining groups
736
- # (Mouth, Tongue, Pupil dilation) stacked as before.
737
  _eye_groups = ["Left eye", "Right eye"]
738
  with gr.Row():
739
  for group_name in _eye_groups:
@@ -746,14 +750,36 @@ with gr.Blocks(title="GNM Head") as demo:
746
  ),
747
  )
748
 
 
 
 
 
 
 
 
 
749
  for group_name, group_idx in EXPRESSION_GROUPS.items():
750
- if group_name in _eye_groups:
751
  continue
752
  expression_sliders += _group_section(
753
  group_name,
754
  _make_expr_builder(group_name, group_idx),
755
  )
756
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
757
  with gr.Tab("Pose"):
758
  gr.Markdown(
759
  "Joint **rotations** in degrees (neck / head) and "
@@ -882,9 +908,19 @@ with gr.Blocks(title="GNM Head") as demo:
882
  _preset(expression={0: -3.0}),
883
  ]
884
 
 
 
 
 
 
 
 
 
 
885
  gr.Examples(
886
  label="Presets (click to load)",
887
  examples=presets,
 
888
  inputs=all_sliders,
889
  outputs=viewer,
890
  fn=positions_json,
 
375
  margin-bottom: 0px;
376
  gap: 8px;
377
  }
378
+ /* Collapse the residual gap the Gradio column inserts between the header row
379
+ and the sliders row (tightening the title-to-sliders vertical space further
380
+ than the previous pass). */
381
+ .gnm-group > .gnm-group-header { margin-bottom: -6px !important; }
382
+ .gnm-group > .gnm-sliders { margin-top: -6px !important; }
383
  .gnm-group-title {
384
  font-weight: 600;
385
  font-size: 0.95rem;
 
417
  flex-direction: column;
418
  align-items: center;
419
  width: 50px;
420
+ padding: 0px 0px 2px 0px;
421
  user-select: none;
422
  -webkit-user-select: none;
423
  box-sizing: border-box;
 
737
  return _build_expr
738
 
739
  # Place the "Left eye" and "Right eye" groups side by
740
+ # side in a single row (equal width).
 
741
  _eye_groups = ["Left eye", "Right eye"]
742
  with gr.Row():
743
  for group_name in _eye_groups:
 
750
  ),
751
  )
752
 
753
+ # "Tongue" and "Pupil dilation" also share a single row,
754
+ # but with an unequal split: Tongue gets 2/3 of the
755
+ # width, Pupil dilation gets 1/3.
756
+ _paired_groups = ["Tongue", "Pupil dilation"]
757
+ _paired_scales = {"Tongue": 2, "Pupil dilation": 1}
758
+
759
+ # Render the remaining stacked groups (Mouth) as before,
760
+ # skipping the eye-row and paired-row groups.
761
  for group_name, group_idx in EXPRESSION_GROUPS.items():
762
+ if group_name in _eye_groups or group_name in _paired_groups:
763
  continue
764
  expression_sliders += _group_section(
765
  group_name,
766
  _make_expr_builder(group_name, group_idx),
767
  )
768
 
769
+ with gr.Row():
770
+ for group_name in _paired_groups:
771
+ group_idx = EXPRESSION_GROUPS[group_name]
772
+ with gr.Column(
773
+ scale=_paired_scales[group_name],
774
+ min_width=0,
775
+ ):
776
+ expression_sliders += _group_section(
777
+ group_name,
778
+ _make_expr_builder(
779
+ group_name, group_idx
780
+ ),
781
+ )
782
+
783
  with gr.Tab("Pose"):
784
  gr.Markdown(
785
  "Joint **rotations** in degrees (neck / head) and "
 
908
  _preset(expression={0: -3.0}),
909
  ]
910
 
911
+ # Per-example captions so each preset is clearly identified in the UI
912
+ # (otherwise gr.Examples renders as a bare unlabeled table of raw slider
913
+ # values). `example_labels` shows a friendly caption per example row.
914
+ preset_labels = [
915
+ "Open mouth + tongue out",
916
+ "Surprised",
917
+ "Wink",
918
+ ]
919
+
920
  gr.Examples(
921
  label="Presets (click to load)",
922
  examples=presets,
923
+ example_labels=preset_labels,
924
  inputs=all_sliders,
925
  outputs=viewer,
926
  fn=positions_json,