Akjava commited on
Commit
4635702
1 Parent(s): 93ab959

update html

Browse files
Files changed (4) hide show
  1. app.py +6 -4
  2. demo_header.html +1 -1
  3. demo_tools.html +7 -1
  4. examples/00003245_00.jpg +0 -0
app.py CHANGED
@@ -44,7 +44,7 @@ def picker_color_to_rgba(picker_color):
44
  return color_value
45
 
46
  #@spaces.GPU(duration=120)
47
- def process_images(image,draw_number,font_scale,text_color_text,dot_size,dot_color_text,line_size,line_color_text,box_size,box_color_text,json_format,progress=gr.Progress(track_tqdm=True)):
48
 
49
  if not os.path.exists(dir_name):
50
  os.mkdir(dir_name)
@@ -63,7 +63,8 @@ def process_images(image,draw_number,font_scale,text_color_text,dot_size,dot_col
63
  dot_color = picker_color_to_rgba(dot_color_text)
64
  box_color = picker_color_to_rgba(box_color_text)
65
 
66
- image=Image.fromarray(mp_box.draw_landmarks_on_image(face_landmarker_result,image))
 
67
 
68
  annotated_image,bbox,landmark_points = draw_landmarks68.draw_landmarks_on_image(image,face_landmarker_result,draw_number,font_scale,text_color,
69
  dot_size,dot_color,line_size,line_color,
@@ -190,6 +191,7 @@ with gr.Blocks(css=css, elem_id="demo-container") as demo:
190
  value=1)
191
  with gr.Row( equal_height=True):
192
  json_format = gr.Radio(choices=["raw","face-detection"],value="face-detection",label="json-output format")
 
193
 
194
  with gr.Column():
195
  image_out = gr.Image(label="Output", elem_id="output-img")
@@ -200,9 +202,9 @@ with gr.Blocks(css=css, elem_id="demo-container") as demo:
200
 
201
  btn.click(fn=process_images, inputs=[image,draw_number,font_scale,text_color,
202
  dot_size,dot_color,line_size,line_color,
203
- box_size,box_color,json_format], outputs =[image_out,text_out,download_button], api_name='infer')
204
  gr.Examples(
205
- examples =["examples/00004200.jpg","examples/00005259.jpg","examples/00018022.jpg","examples/img-above.jpg","examples/img-below.jpg","examples/img-side.jpg"],
206
  inputs=[image]
207
  )
208
  gr.HTML(read_file("demo_footer.html"))
 
44
  return color_value
45
 
46
  #@spaces.GPU(duration=120)
47
+ def process_images(image,draw_number,font_scale,text_color_text,dot_size,dot_color_text,line_size,line_color_text,box_size,box_color_text,json_format,draw_mesh=False,progress=gr.Progress(track_tqdm=True)):
48
 
49
  if not os.path.exists(dir_name):
50
  os.mkdir(dir_name)
 
63
  dot_color = picker_color_to_rgba(dot_color_text)
64
  box_color = picker_color_to_rgba(box_color_text)
65
 
66
+ if draw_mesh:
67
+ image=Image.fromarray(mp_box.draw_landmarks_on_image(face_landmarker_result,image))
68
 
69
  annotated_image,bbox,landmark_points = draw_landmarks68.draw_landmarks_on_image(image,face_landmarker_result,draw_number,font_scale,text_color,
70
  dot_size,dot_color,line_size,line_color,
 
191
  value=1)
192
  with gr.Row( equal_height=True):
193
  json_format = gr.Radio(choices=["raw","face-detection"],value="face-detection",label="json-output format")
194
+ draw_mesh = gr.Checkbox(label="draw mesh",info="draw mediapipe mesh")
195
 
196
  with gr.Column():
197
  image_out = gr.Image(label="Output", elem_id="output-img")
 
202
 
203
  btn.click(fn=process_images, inputs=[image,draw_number,font_scale,text_color,
204
  dot_size,dot_color,line_size,line_color,
205
+ box_size,box_color,json_format,draw_mesh], outputs =[image_out,text_out,download_button], api_name='infer')
206
  gr.Examples(
207
+ examples =["examples/00003245_00.jpg","examples/00004200.jpg","examples/00005259.jpg","examples/00018022.jpg","examples/img-above.jpg","examples/img-below.jpg","examples/img-side.jpg"],
208
  inputs=[image]
209
  )
210
  gr.HTML(read_file("demo_footer.html"))
demo_header.html CHANGED
@@ -3,7 +3,7 @@
3
  Mediapipe 68-points facial landmark
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="http://www.apache.org/licenses/LICENSE-2.0">the Apache 2.0</a> Licensed <a href="https://ai.google.dev/edge/mediapipe/solutions/vision/face_landmarker">Mediapipe FaceLandmarker</a> <br>
 
3
  Mediapipe 68-points facial landmark
4
  </h1>
5
  <div class="grid-container">
6
+ <img src="https://akjava.github.io/AIDiagramChatWithVoice-FaceCharacter/webp/128/00428245.webp" alt="Mediapipe Face Detection" class="image">
7
 
8
  <p class="text">
9
  This Space use <a href="http://www.apache.org/licenses/LICENSE-2.0">the Apache 2.0</a> Licensed <a href="https://ai.google.dev/edge/mediapipe/solutions/vision/face_landmarker">Mediapipe FaceLandmarker</a> <br>
demo_tools.html CHANGED
@@ -1,4 +1,10 @@
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>
 
1
  <div style="text-align: center;">
2
+ <p>
3
+ <a href="https://huggingface.co/spaces/Akjava/mediapipe-face-detect">Mediapipe Face detector</a> |
4
+ <a href="https://huggingface.co/spaces/Akjava/mediapipe-face-crop-and-replace">Face Crop and Replace</a> |
5
+ <a href="https://huggingface.co/spaces/Akjava/mediapipe-68-points-facial-landmark">68 points landmark</a> |
6
+ <a href="https://huggingface.co/spaces/Akjava/mediapipe-68-points-facial-mask">Create 68 points Parts Mask</a> |
7
+ <a href="https://huggingface.co/spaces/Akjava/histgram-color-matching">Histgram Color Matching</a>
8
+ </p>
9
  <p></p>
10
  </div>
examples/00003245_00.jpg ADDED