Update app.py
Browse files
app.py
CHANGED
@@ -115,17 +115,19 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
|
115 |
cv2.rectangle(img, (x, y), (x + bw, y + bh), (0, 255, 160), -1)
|
116 |
cv2.putText(img, button.text, (x + int(0.2 * bw), y + int(0.7 * bh)), cv2.FONT_HERSHEY_PLAIN, font_scale, (255, 255, 255), font_thickness)
|
117 |
|
118 |
-
|
119 |
-
if (distance / np.sqrt(bbox[2] ** 2 + bbox[3] ** 2)) * 100 < click_threshold:
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
|
|
129 |
|
130 |
result_queue.put(detections)
|
131 |
|
|
|
115 |
cv2.rectangle(img, (x, y), (x + bw, y + bh), (0, 255, 160), -1)
|
116 |
cv2.putText(img, button.text, (x + int(0.2 * bw), y + int(0.7 * bh)), cv2.FONT_HERSHEY_PLAIN, font_scale, (255, 255, 255), font_thickness)
|
117 |
|
118 |
+
# # Handle button press
|
119 |
+
# if (distance / np.sqrt(bbox[2] ** 2 + bbox[3] ** 2)) * 100 < click_threshold:
|
120 |
+
# if time.time() - prev_key_time[0] > 2:
|
121 |
+
# prev_key_time[0] = time.time()
|
122 |
+
# if button.text != 'BS' and button.text != 'SPACE':
|
123 |
+
# st.session_state["output_text"] += button.text # Append key to output text
|
124 |
+
# elif button.text == 'BS':
|
125 |
+
# st.session_state["output_text"] = st.session_state["output_text"][:-1] # Remove last character
|
126 |
+
# else:
|
127 |
+
# st.session_state["output_text"] += ' ' # Add space
|
128 |
+
if distance<30:
|
129 |
+
st.session_state["output_text"] += button.text
|
130 |
+
|
131 |
|
132 |
result_queue.put(detections)
|
133 |
|