I am thinking of using streamlit on a headless machine on which I run opencv that acquires frames from a webcam.
I am just testing this simple script:
import cv2 import streamlit as st import time cap = cv2.VideoCapture(0) cap.set(3,640) cap.set(4,480) my_placeholder = st.empty() while True: success, img = cap.read() #cv2.imshow("immagine",img) my_placeholder.image(img, use_column_width=True) time.sleep(0.1) if cv2.waitKey(1) & 0xFF == ord('q'): break # wait for ESC key to exit cap.release() cv2.destroyAllWindows()
which has 2 limits:
- I am forced to slow down the while loop ( when I am going to add some ML it will not be a problem)
- I get from streamlit the following errors:
MediaFileManager: Missing file 78c16466698a216a45ce28c152528e16a6437e66caf1926d8c4aa61d MediaFileManager: Missing file f60585d35644b3cf69098c6e28c630230a5e1283f0543a625bbb8aff MediaFileManager: Missing file 4d3f29b5ba094e1f9ad5c2e9cb85d290d3bbb6ba4a3037c124cdbdc6
In other words I want to display on a remote machine the results of image recognition algorithms using streamline web interface.
any suggestions on how to improve it and solving the errors…
pls the code is short, try on your own.