Kikut commited on
Commit
c114a19
·
verified ·
1 Parent(s): 6058d13

Deploy IG test profile studio

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. README.md +3 -1
  3. app.py +6 -1
  4. assets/default_persona.jpg +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ assets/default_persona.jpg filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -12,10 +12,12 @@ pinned: false
12
 
13
  This Space is dedicated to a single workflow:
14
 
15
- - upload a persona image
16
  - stream webcam input
17
  - get live full-body replacement output
18
 
19
  If segmentation is uncertain for a frame, the app falls back to a body-box estimate to keep the stream responsive.
20
 
 
 
21
  Set `HF_TOKEN` as a Space secret to avoid entering it in the UI.
 
12
 
13
  This Space is dedicated to a single workflow:
14
 
15
+ - use preloaded persona image (or upload your own)
16
  - stream webcam input
17
  - get live full-body replacement output
18
 
19
  If segmentation is uncertain for a frame, the app falls back to a body-box estimate to keep the stream responsive.
20
 
21
+ Default persona source: https://www.pexels.com/photo/elegant-woman-in-all-white-outfit-with-hijab-31215273/
22
+
23
  Set `HF_TOKEN` as a Space secret to avoid entering it in the UI.
app.py CHANGED
@@ -1,6 +1,7 @@
1
  from __future__ import annotations
2
 
3
  import time
 
4
  from typing import Any
5
 
6
  import cv2
@@ -19,6 +20,9 @@ FACE_CASCADE = cv2.CascadeClassifier(
19
  UPPER_BODY_CASCADE = cv2.CascadeClassifier(
20
  cv2.data.haarcascades + "haarcascade_upperbody.xml"
21
  )
 
 
 
22
 
23
 
24
  def _init_selfie_segmenter() -> tuple[Any | None, str]:
@@ -547,8 +551,9 @@ Only one workflow is enabled:
547
  mirror = gr.Checkbox(label="Mirror output", value=True)
548
 
549
  avatar_upload = gr.Image(
550
- label="Persona image (required, best: full-body portrait)",
551
  type="numpy",
 
552
  )
553
 
554
  with gr.Row():
 
1
  from __future__ import annotations
2
 
3
  import time
4
+ from pathlib import Path
5
  from typing import Any
6
 
7
  import cv2
 
20
  UPPER_BODY_CASCADE = cv2.CascadeClassifier(
21
  cv2.data.haarcascades + "haarcascade_upperbody.xml"
22
  )
23
+ APP_DIR = Path(__file__).resolve().parent
24
+ DEFAULT_AVATAR_PATH = APP_DIR / "assets" / "default_persona.jpg"
25
+ DEFAULT_AVATAR_VALUE = str(DEFAULT_AVATAR_PATH) if DEFAULT_AVATAR_PATH.exists() else None
26
 
27
 
28
  def _init_selfie_segmenter() -> tuple[Any | None, str]:
 
551
  mirror = gr.Checkbox(label="Mirror output", value=True)
552
 
553
  avatar_upload = gr.Image(
554
+ label="Persona image (preloaded; replace if you want another look)",
555
  type="numpy",
556
+ value=DEFAULT_AVATAR_VALUE,
557
  )
558
 
559
  with gr.Row():
assets/default_persona.jpg ADDED

Git LFS Details

  • SHA256: 6a17cae1dbd1bf18273aee5854fb615ea55984bb3b790ca7e32a988ea62885a1
  • Pointer size: 131 Bytes
  • Size of remote file: 351 kB