Pratyush101 commited on
Commit
95127e7
·
verified ·
1 Parent(s): 8eb542c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -116,7 +116,7 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
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
 
121
  if time.time() - prev_key_time[0] > 2:
122
  prev_key_time[0] = time.time()
@@ -138,18 +138,12 @@ st.text_area("Typed Text", st.session_state["output_text"], height=150)
138
 
139
  st.write(st.session_state["output_text"])
140
 
 
141
  webrtc_streamer(
142
  key="virtual-keyboard",
143
  mode=WebRtcMode.SENDRECV,
144
  rtc_configuration={"iceServers": get_ice_servers(), "iceTransportPolicy": "relay"},
145
- media_stream_constraints={
146
- "video": {
147
- "width": {"exact": 640},
148
- "height": {"exact": 480},
149
- "frameRate": {"ideal": 30}
150
- },
151
- "audio": False,
152
- },
153
  video_frame_callback=video_frame_callback,
154
  async_processing=True,
155
  )
 
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 < 0.2*h:
120
 
121
  if time.time() - prev_key_time[0] > 2:
122
  prev_key_time[0] = time.time()
 
138
 
139
  st.write(st.session_state["output_text"])
140
 
141
+ # WebRTC Streamer
142
  webrtc_streamer(
143
  key="virtual-keyboard",
144
  mode=WebRtcMode.SENDRECV,
145
  rtc_configuration={"iceServers": get_ice_servers(), "iceTransportPolicy": "relay"},
146
+ media_stream_constraints={"video": True, "audio": False},
 
 
 
 
 
 
 
147
  video_frame_callback=video_frame_callback,
148
  async_processing=True,
149
  )