OpenCV & Appgyver

So I may be biting off much more than I can chew but here’s the gist of my project.

I have hacked together a Python script that processes images in a very specific way. I have done this by using snippets of code from here and there and making subtle modifications till it just works. The code is not perfect yet but with a bit more tinkering I think it will be usable.

Now this code uses the python libraries Open CV and Numpy. What is the best way to have this script run on my app which I will make using appgyver? I have two options:-

1.) The script runs when the user takes pictures and processing is done on the user’s device. (Best case scenario). Is this even possible?

2.) The user takes images and sends an API call to a webserver which returns the processed image. This entails a lot of work in domains I am not familiar with. This option means I will have to do all of the work from scratch which I am not afraid of but there will also be a considerable lag time because of slow speed of data transfer to & fro.

Is there any other way to accomplish this or any ideas on how I can implement option # 1?