Making an android app

It’s not a problem to integrate Python into your app, but adding PyTorch or Tensorflow or any other framework is completely different problem.
Mainly because those libraries usually rely on native bindings which are not available for Android.

Speaking about performance, your best choice would be TensorFlow(lite) or any other framework that supports Android Neural Networks API.

Otherwise you would rely on quality of ported code by 3rd-parties. For example, tutorial you mentioned contains no black magic - they just provide you native (C++) library and it’s up to you to implement all required integrations with your client code.

Also, check this Pytorch model running in Android - #4 by ptrblck

Do I really have to use Android Studio to create an app. Can I make APK in Python?

No, you are not required to use Android Studio. Even Android SDK is optional (you may write your own implementation of existing tools - they are open source). But you have to satisfy APK format in one or another way: compile code → convert to DEX → archive everything into APK (which is just ZIP with extra meta info) → zipalign & sign

1 Like