There is no physical way to have your python scrip running "in the app".
From what I see, you'd like the image to be processed by those Python packages.
The ideal approach would be that:
- The app saves the image somewhere (via backend)
- Your script (python) is running somewhere on some server (AWS EC2, for example), takes the saved image from the app and processes it
- The script saves back to the DB
- App fetches the results (via backend)