Update app.py
Browse files
app.py
CHANGED
@@ -93,8 +93,8 @@ def process_video(stop_event, frame_queue, caption_queue, processor, source_type
|
|
93 |
frame = cv2.resize(frame, (800, 600))
|
94 |
current_time = time.time()
|
95 |
|
96 |
-
# Generate caption every
|
97 |
-
if current_time - last_caption_time >=
|
98 |
img = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
99 |
caption = processor.generate_caption(img)
|
100 |
timestamp = datetime.now().strftime("%H:%M:%S")
|
@@ -114,7 +114,7 @@ def process_video(stop_event, frame_queue, caption_queue, processor, source_type
|
|
114 |
except queue.Full:
|
115 |
pass
|
116 |
|
117 |
-
time.sleep(0.03)
|
118 |
|
119 |
cap.release()
|
120 |
|
@@ -220,7 +220,7 @@ def main():
|
|
220 |
caption_placeholder.markdown(caption_text)
|
221 |
|
222 |
except queue.Empty:
|
223 |
-
time.sleep(0.01)
|
224 |
continue
|
225 |
|
226 |
if __name__ == "__main__":
|
|
|
93 |
frame = cv2.resize(frame, (800, 600))
|
94 |
current_time = time.time()
|
95 |
|
96 |
+
# Generate caption every 8 seconds
|
97 |
+
if current_time - last_caption_time >= 8.0:
|
98 |
img = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
99 |
caption = processor.generate_caption(img)
|
100 |
timestamp = datetime.now().strftime("%H:%M:%S")
|
|
|
114 |
except queue.Full:
|
115 |
pass
|
116 |
|
117 |
+
# time.sleep(0.03)
|
118 |
|
119 |
cap.release()
|
120 |
|
|
|
220 |
caption_placeholder.markdown(caption_text)
|
221 |
|
222 |
except queue.Empty:
|
223 |
+
# time.sleep(0.01)
|
224 |
continue
|
225 |
|
226 |
if __name__ == "__main__":
|