Update app.py
Browse files
app.py
CHANGED
@@ -101,15 +101,15 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
|
101 |
|
102 |
|
103 |
# Simulate key press if finger close enough
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
|
114 |
result_queue.put(detections)
|
115 |
st.session_state["output_text"] = output_text
|
|
|
101 |
|
102 |
|
103 |
# Simulate key press if finger close enough
|
104 |
+
if (distance / np.sqrt(bbox[2] ** 2 + bbox[3] ** 2)) * 100 < click_threshold:
|
105 |
+
if time.time() - prev_key_time[0] > 2:
|
106 |
+
prev_key_time[0] = time.time()
|
107 |
+
if button.text != 'BS' and button.text != 'SPACE':
|
108 |
+
output_text += button.text
|
109 |
+
elif button.text == 'BS':
|
110 |
+
output_text = output_text[:-1]
|
111 |
+
else:
|
112 |
+
output_text += ' '
|
113 |
|
114 |
result_queue.put(detections)
|
115 |
st.session_state["output_text"] = output_text
|