osanseviero HF staff commited on
Commit
a2d1102
1 Parent(s): 30ab7f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -13
app.py CHANGED
@@ -3,15 +3,14 @@ import mediapipe as mp
3
  import numpy as np
4
  import cv2
5
 
6
- title = "Hugging Face Me"
7
- description = " Demo for overlaying the Hugging Face logo on your face using the Mediapipe Face Detection model."
8
  article = "<p style='text-align: center'><a href='https://google.github.io/mediapipe/solutions/face_detection.html' target='_blank'>Mediapipe Face Detection</a> | <a href='https://github.com/google/mediapipe' target='_blank'>Github Repo</a></p>"
9
 
10
  mp_face_detection = mp.solutions.face_detection
11
  mp_drawing = mp.solutions.drawing_utils
12
 
13
- def draw_huggingfaces(image, results):
14
-
15
  height, width, _ = image.shape
16
 
17
  output_img = image.copy()
@@ -29,8 +28,7 @@ def draw_huggingfaces(image, results):
29
  return output_img
30
 
31
 
32
- def huggingface_me(image):
33
-
34
  with mp_face_detection.FaceDetection(
35
  model_selection=0,
36
  min_detection_confidence=0.5) as face_detection:
@@ -45,14 +43,11 @@ huggingface_image = cv2.imread("images/hugging-face.png", cv2.IMREAD_UNCHANGED)
45
  huggingface_image = cv2.cvtColor(huggingface_image, cv2.COLOR_BGRA2RGBA)
46
  huggingface_landmarks = np.array([[747,697],[1289,697],[1022,1116]], dtype=np.float32)
47
 
48
- webcam_image = gr.inputs.Image(label="Input Image", source="webcam")
49
- output_image = gr.outputs.Image(label="Output Image")
50
 
51
- gr.Interface(huggingface_me,
52
- live=True,
53
- inputs=webcam_image,
54
- outputs=output_image,
55
  title=title,
56
  description=description,
57
- article=article, ).launch()
58
 
 
3
  import numpy as np
4
  import cv2
5
 
6
+ title = "Mishigify Me"
7
+ description = " Demo for adding some mishig to this"
8
  article = "<p style='text-align: center'><a href='https://google.github.io/mediapipe/solutions/face_detection.html' target='_blank'>Mediapipe Face Detection</a> | <a href='https://github.com/google/mediapipe' target='_blank'>Github Repo</a></p>"
9
 
10
  mp_face_detection = mp.solutions.face_detection
11
  mp_drawing = mp.solutions.drawing_utils
12
 
13
+ def draw_mishigs(image, results):
 
14
  height, width, _ = image.shape
15
 
16
  output_img = image.copy()
 
28
  return output_img
29
 
30
 
31
+ def mishig_me(image):
 
32
  with mp_face_detection.FaceDetection(
33
  model_selection=0,
34
  min_detection_confidence=0.5) as face_detection:
 
43
  huggingface_image = cv2.cvtColor(huggingface_image, cv2.COLOR_BGRA2RGBA)
44
  huggingface_landmarks = np.array([[747,697],[1289,697],[1022,1116]], dtype=np.float32)
45
 
 
 
46
 
47
+ gr.Interface(mishig_me,
48
+ inputs=gr.Image(label="Input Image", source="webcam"),
49
+ outputs=gr.Image(label="Output Image"),
 
50
  title=title,
51
  description=description,
52
+ article=article).launch()
53