Hi @Shubham_Singh, welcome to the community!
The error is caused by line 137 of your app, where you run a Python script in a subprocess.
- The packages in your requirements file are installed in a virtual environment. The Python binary used in this virtual env is found at
/home/appuser/venv/bin/python
- In line 137 of your app, you run
python detect.py --weights ...
via a subprocess. This Python binary is not the one used in the virtual env where your packages, includingopencv-python-headless
, are installed. - Change line 137 to the following:
detectCommand = "/home/appuser/venv/bin/python detect.py --weights ./resources/weights/best.pt --source ./resources/test_image/businessCard/ --img 512 --conf 0.6 --save-crop --save-conf --line-thickness 2 --iou-thres 0.5 --save-txt --name results"
- Replace
opencv-python
in your requirements file withopencv-python-headless
- Delete
packages.txt
- Reboot your app
Once you make the above changes, your detection script will run fine
Happy Streamlit-ing!
Snehan