Reputation: 79
We are building an OCR application on Swift for iOS devices. We have developed an OCR code on Python using few libraries using Tessearct and OpenCV. But we cannot find a way to integrate our Python code with Swift iOS? Is there any way. Please help?
Upvotes: 0
Views: 1040
Reputation: 1686
To run python code on an iOS device you will need to have a Python interpreter. I won't say it is impossible because I have seen Javascript, and specifically the Cocos2d interpreter that is written in CPP and run both on iOS and Android as a cross platform game engine.
Having said that and following the comments you have received, it is not the best practice, and I think it will be easier to convert your OpenCV and Tessearct Python code into CPP instead of maintaining / writing your own interpreter.
Moreover, these two libraries might use some specific CPU or GPU capabilities that I can only guess will be very hard to use without the native CPP code on iOS device.
[UPDATE] Lastly, if you are not in an offline system, and can have an online API and wrap your python code in a web service. You would be able to query your online service remotely from the iOS device, pass all the needed information in the request and get the output of the model in the response.
Upvotes: 1