Edited Interface
Browse files
app.py
CHANGED
@@ -57,7 +57,7 @@ def find_hands(brain, img):
|
|
57 |
def is_drawing(index, thumb): # proximity function with arbitrary threshold
|
58 |
npindex = np.array((index[0], index[1]))
|
59 |
npthumb = np.array((thumb[0], thumb[1]))
|
60 |
-
if np.linalg.norm(npindex - npthumb) <
|
61 |
return True
|
62 |
else:
|
63 |
return False
|
@@ -99,7 +99,6 @@ def show(video, dominant_hand, hex_color): # main
|
|
99 |
global sleepy_time # get sleep time for multiple gestures
|
100 |
|
101 |
while cam.isOpened():
|
102 |
-
# runny -= 1
|
103 |
x, rgb_image = cam.read()
|
104 |
rgb_image_f = cv2.flip(rgb_image, 1) # mirrored video
|
105 |
|
@@ -201,11 +200,11 @@ def show(video, dominant_hand, hex_color): # main
|
|
201 |
return 'any.webm'
|
202 |
|
203 |
title = 'Air Draw'
|
204 |
-
desc = 'A
|
205 |
iface = gr.Interface(
|
206 |
fn=show,
|
207 |
inputs=[
|
208 |
-
gr.inputs.Video(source="webcam", label="Record
|
209 |
gr.inputs.Radio(['Right', 'Left'], label="Dominant Hand"),
|
210 |
gr.inputs.Textbox(placeholder="#355C7D", label="Hex Color")
|
211 |
],
|
|
|
57 |
def is_drawing(index, thumb): # proximity function with arbitrary threshold
|
58 |
npindex = np.array((index[0], index[1]))
|
59 |
npthumb = np.array((thumb[0], thumb[1]))
|
60 |
+
if np.linalg.norm(npindex - npthumb) < 13:
|
61 |
return True
|
62 |
else:
|
63 |
return False
|
|
|
99 |
global sleepy_time # get sleep time for multiple gestures
|
100 |
|
101 |
while cam.isOpened():
|
|
|
102 |
x, rgb_image = cam.read()
|
103 |
rgb_image_f = cv2.flip(rgb_image, 1) # mirrored video
|
104 |
|
|
|
200 |
return 'any.webm'
|
201 |
|
202 |
title = 'Air Draw'
|
203 |
+
desc = 'A mediapipe hands wrapper for drawing in the air. Position your fingers in a "drawing" form to draw, and open up your hand to lift the "pen" from the "paper". Use a "thumbs up gesture to clear the drawing paper".'
|
204 |
iface = gr.Interface(
|
205 |
fn=show,
|
206 |
inputs=[
|
207 |
+
gr.inputs.Video(source="webcam", label="Record yourself drawing in the air!"),
|
208 |
gr.inputs.Radio(['Right', 'Left'], label="Dominant Hand"),
|
209 |
gr.inputs.Textbox(placeholder="#355C7D", label="Hex Color")
|
210 |
],
|