Update app.py
Browse files
app.py
CHANGED
@@ -47,9 +47,8 @@ indexImg = 0
|
|
47 |
output_text = ""
|
48 |
prev_key_time = [time.time()] * 2
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
text=""
|
53 |
|
54 |
# Video Frame Callback with Your Logic
|
55 |
def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
@@ -126,19 +125,19 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
|
126 |
# st.session_state["output_text"] = st.session_state["output_text"][:-1] # Remove last character
|
127 |
# else:
|
128 |
# st.session_state["output_text"] += ' ' # Add space
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
|
134 |
|
135 |
result_queue.put(detections)
|
136 |
|
137 |
return av.VideoFrame.from_ndarray(img, format="bgr24")
|
138 |
|
139 |
-
|
140 |
|
141 |
-
st.write(
|
142 |
|
143 |
# WebRTC Streamer
|
144 |
webrtc_streamer(
|
|
|
47 |
output_text = ""
|
48 |
prev_key_time = [time.time()] * 2
|
49 |
|
50 |
+
if "output_text" not in st.session_state:
|
51 |
+
st.session_state["output_text"] = ""
|
|
|
52 |
|
53 |
# Video Frame Callback with Your Logic
|
54 |
def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
|
|
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 <100:
|
129 |
+
st.session_state["output_text"] += "hi"
|
130 |
+
|
131 |
+
|
132 |
|
133 |
|
134 |
result_queue.put(detections)
|
135 |
|
136 |
return av.VideoFrame.from_ndarray(img, format="bgr24")
|
137 |
|
138 |
+
st.text_area("Typed Text", st.session_state["output_text"], height=150)
|
139 |
|
140 |
+
st.write(st.session_state["output_text"])
|
141 |
|
142 |
# WebRTC Streamer
|
143 |
webrtc_streamer(
|