Akjava commited on
Commit
ae6ad89
·
1 Parent(s): 8410b30

fix no image

Browse files
Files changed (3) hide show
  1. app.py +7 -3
  2. demo_header.html +7 -3
  3. demo_tools.html +1 -7
app.py CHANGED
@@ -22,6 +22,9 @@ So I don't know which one is better.never compare these.
22
  '''
23
  #@spaces.GPU(duration=120)
24
  def process_images(image,no_mesh_draw=False,square_shape=False,progress=gr.Progress(track_tqdm=True)):
 
 
 
25
  progress(0, desc="Start Mediapipe")
26
 
27
  boxes,mp_image,face_landmarker_result = mp_box.mediapipe_to_box(image)
@@ -48,10 +51,11 @@ def process_images(image,no_mesh_draw=False,square_shape=False,progress=gr.Progr
48
  print(box)
49
  print(mp_box.xywh_to_xyxy(box))
50
  annotation_boxes.append([mp_box.xywh_to_xyxy(box),label])
51
- index+=1
52
 
53
  jsons[label] = boxes[index-1]
54
- print(label)
 
55
 
56
  #print(annotation_boxes)
57
  formatted_json = json.dumps(jsons, indent=1)
@@ -110,7 +114,7 @@ with gr.Blocks(css=css, elem_id="demo-container") as demo:
110
  with gr.Accordion(label="Advanced Settings", open=False):
111
  with gr.Row( equal_height=True):
112
  no_mesh_draw = gr.Checkbox(label="No Mesh Drawing")
113
- square_shape = gr.Checkbox(label="square shape")
114
 
115
  with gr.Column():
116
  image_out = gr.AnnotatedImage(label="Output", elem_id="output-img")
 
22
  '''
23
  #@spaces.GPU(duration=120)
24
  def process_images(image,no_mesh_draw=False,square_shape=False,progress=gr.Progress(track_tqdm=True)):
25
+ if image == None:
26
+ raise gr.Error("Need Image")
27
+
28
  progress(0, desc="Start Mediapipe")
29
 
30
  boxes,mp_image,face_landmarker_result = mp_box.mediapipe_to_box(image)
 
51
  print(box)
52
  print(mp_box.xywh_to_xyxy(box))
53
  annotation_boxes.append([mp_box.xywh_to_xyxy(box),label])
54
+
55
 
56
  jsons[label] = boxes[index-1]
57
+ print(index)
58
+ index+=1
59
 
60
  #print(annotation_boxes)
61
  formatted_json = json.dumps(jsons, indent=1)
 
114
  with gr.Accordion(label="Advanced Settings", open=False):
115
  with gr.Row( equal_height=True):
116
  no_mesh_draw = gr.Checkbox(label="No Mesh Drawing")
117
+ square_shape = gr.Checkbox(label="Square shape")
118
 
119
  with gr.Column():
120
  image_out = gr.AnnotatedImage(label="Output", elem_id="output-img")
demo_header.html CHANGED
@@ -3,10 +3,14 @@
3
  Mediapipe Face Detect
4
  </h1>
5
  <div class="grid-container">
6
- <img src="https://akjava.github.io/AIDiagramChatWithVoice-FaceCharacter/webp/128/00191245_09_00002200.webp" alt="Flux.1-schnell-WebP3Frame-TalkingAnimation" class="image">
7
- This Space use <a href="https://ai.google.dev/edge/mediapipe/solutions/vision/face_landmarker">Mediapipe face landmark detection model</a> which licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0">the Apache 2.0 License</a>
8
  <p class="text">
9
-
 
 
 
 
10
  </p>
11
  </div>
12
 
 
3
  Mediapipe Face Detect
4
  </h1>
5
  <div class="grid-container">
6
+ <img src="https://akjava.github.io/AIDiagramChatWithVoice-FaceCharacter/webp/128/00191245_09_00002200.webp" alt="Mediapipe Face Detection" class="image">
7
+
8
  <p class="text">
9
+ This Space use <a href="https://ai.google.dev/edge/mediapipe/solutions/vision/face_landmarker">Mediapipe face landmark detection model</a> which licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0">the Apache 2.0 License</a>
10
+ type-1 is minimum face detection for inner face point like dlib-5-point<br>
11
+ type-2 is standard face detection + marging works well<br>
12
+ type-3 is mediapipe-landmarks maximum outside<br>
13
+ square shape:some trainer need square shape like dlib<br>
14
  </p>
15
  </div>
16
 
demo_tools.html CHANGED
@@ -1,10 +1,4 @@
1
  <div style="text-align: center;">
2
  <p><a href="https://huggingface.co/spaces/Akjava/mediapipe-face-detect">Mediapipe Face detector</a></p>
3
- <p><a href="https://huggingface.co/spaces/Akjava/WebPTalkHead">[WebP-3F-TH]</a>
4
- <a href="https://huggingface.co/spaces/Akjava/flux1-schnell-img2img">[Flux1-Img2Img(GPU)]</a>
5
- <a href="https://huggingface.co/spaces/Akjava/flux1-schnell-mask-inpaint">[Flux1-Inpaint(GPU)]</a>
6
- <a href="https://huggingface.co/spaces/Akjava/OpenCVInpaintCPU">[OpenCV-Inapint]</a>
7
- <a href="https://huggingface.co/spaces/Akjava/Simple-Whitebalance-Image">[Whitebalance]</a>
8
- <a href="https://huggingface.co/spaces/Akjava/Simple-Mask-Paste-Image">[Paste Image]</a>
9
- <a href=" https://huggingface.co/spaces/Akjava/WebP-Resize-Convert">[WebP Resize Convert]</a></p>
10
  </div>
 
1
  <div style="text-align: center;">
2
  <p><a href="https://huggingface.co/spaces/Akjava/mediapipe-face-detect">Mediapipe Face detector</a></p>
3
+ <p></p>
 
 
 
 
 
 
4
  </div>