Update app.py
Browse files
app.py
CHANGED
@@ -115,7 +115,7 @@ 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 |
if button.text != 'BS' and button.text != 'SPACE':
|
118 |
-
|
119 |
# # # Handle button press
|
120 |
# if (distance / np.sqrt(bbox[2] ** 2 + bbox[3] ** 2)) * 100:
|
121 |
|
@@ -127,6 +127,8 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
|
127 |
# st.session_state["output_text"] = st.session_state["output_text"][:-1] # Remove last character
|
128 |
# else:
|
129 |
# st.session_state["output_text"] += ' ' # Add space
|
|
|
|
|
130 |
|
131 |
|
132 |
|
|
|
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 |
if button.text != 'BS' and button.text != 'SPACE':
|
118 |
+
output_text += button.text # Append key to output text
|
119 |
# # # Handle button press
|
120 |
# if (distance / np.sqrt(bbox[2] ** 2 + bbox[3] ** 2)) * 100:
|
121 |
|
|
|
127 |
# st.session_state["output_text"] = st.session_state["output_text"][:-1] # Remove last character
|
128 |
# else:
|
129 |
# st.session_state["output_text"] += ' ' # Add space
|
130 |
+
# Display typed text
|
131 |
+
cv2.putText(img, output_text, (int(0.05 * w) , int(0.95 * h)), cv2.FONT_HERSHEY_PLAIN, 5, (255, 255, 255), 5)
|
132 |
|
133 |
|
134 |
|