TensorFlow Lite: Update existing model or add new one in deployed app - flutter

I'm creating a mobile app (with Flutter, for more details) that will need to do some offline inference using TensorFlow Lite models. The fact this needs to be offline means the models need to be shipped with the APP.
I know how to deploy the models with the APP (see this tutorial, for example; there are plenty out there) but, as these might change over time - for example re-trained for better accuracy with new data or even new models added to analyse different things - it will be good to find a way of doing that without the need to update the whole application.
So far, the only options I have found for the dynamic update/addition of models require the APP connecting to an external service hosting the models, like Firebase, but that's not good enough when the APP needs to run offline.
Do you have any suggestion on how to do this?
Many thanks,
Diego

I'm sorry, but are you saying you want to update the app (one part of the app) without internet connection (or network connection)? The act of updating the app from the Play Store/ App Store requires an internet connection.
Manually install new application updates. This would be updating the entire app, not just the model file, but this is fine, you just don't have to make any code changes.
On Android: Install a new APK adb install, and
On iOS: use Adhoc distribution
Model file picker and manual model selection: Alternatively, you can add a file picker in the application to select a local model file. This model file will need to be on the device, which you can copy onto the device manually (e.g. adb push model.tflite on Android, Airdrop on iOS).
Local network hosted model: Or you can download the model from the local network automatically (still "offline"/ no internet connection).

Related

How to run code during app uninstall in flutter

I would like to run code to delete files created on local storage when my flutter app is uninstalled. How can I do the same? Is there any event to handle this? If not, how can I clean up the images generated?I don't see any reference online for this.
If you are saving images to users gallery, that image is no longer the domain of your app, in any way shape or form. If you create a gallery within your app this would be different, also, a gallery within your app would in fact be deleted along with any other memory your app uses. I highly doubt you could access users gallery & delete images even with users permission.
Possible backend server solution: here
This indicates this is not possible as per below:
All of your app's files are deleted by the OS when the user deletes
the app. If Apple wanted developers to have that capability, we would
have that capability 🙂
You could make a case for needing to know the app is deleted if you
are storing stuff on the server side. Currently from the server's
point of view there's no way to know whether the app was deleted or
the user just stopped using it. But locally stored files are not an
issue.
I am also looking for a solution to this & I think server logic will get it done.
Must be some sort of logic possible to discover server side if user is GONE!

Provide a Flutter WebApp from within an iOS Flutter app

I'd like to create a flutter IOS app which stores data and allows to edit it within the iOS app.
Then the iOS app be able to provide a webserver [start an internal webserver e.g. using jaguar] and serve a WebApp, which operates on the same data on the iDevice.
Idea: Make the iDevice the only data store. And allow a e.g. windows client to access the data on the iOS device using a web interface [and not require it to push it into a cloud].
I have used Flutter jaguar to make it work, have you tried to run the example ?
I think what would be very challenging is that IOS kill background processes, so to use your IOS app as a (reliable) server in the background would be impossible (if reliability, and it should, is a concern), only audio streaming apps would not be killed. So it means you will have to run your server at all time in the foreground
And not to mention that if your phone is out of battery it would also stop working (but of course, you are aware of that, and that's true that if connect to charger, it could perfectly act as a server, as I have tested myself!).
NB: If it's for some serious project, not a fun personal project/challenge, I advise you to reconsider and what you could still do is to manage your server data from the IOS app (meaning that you would send data on on-premise or cloud server like Firebase). But as you stated in your question you are looking to make it work on the Iphone device.

Can I pre-cache data to work offline in mobile app using AppSync?

I am developing an Android and iOS app that could be used in areas that have a very poor or no data connection. It is a requirement for the app to be pre-loaded with all of the data so it will work even if the app never communicated with the server, but it also needs to be able to update and sync when a connection is made. Is it possible to manually populate the AppSync (Apollo) cache database with data on launch and query and mutate it later? The app also contains several search and filter queries. Our backend API is currently using GraphQL.
I have seen this question, Is it possible to build offline-first mobile apps using AWS AppSync?, but it is a little different that what I'm asking.
The recommendation would be to hydrate (read: pre-load with data) a local SQLite database after install. SQLite is what the 'local cache' uses to persist data on the device.
Refer to this github issue for a code example of how to do this:
https://github.com/awslabs/aws-mobile-appsync-sdk-js/issues/160

Running web files inside an iOS App

I'm working on a project that will need to be inside an iOS app as well as a website. It will need to run inside the app since it will must be accessed without a wireless connection.
Is it possible to run my web files inside the app without using something like phone gap?
What is the web connection for? Is it for user authentication? Is it for parsing data from a website? It really depends what you need an internet connection for, if you need some external data from a website or database then you would need to internally create some stores/sqlite db's to hold the data and sync that data when there is a connection.
If you are just running a client side app that you decided to create in HTML then I'd still use Sencha Touch, then Cordova to get it to compile natively.
You can always "Add to home screen" from Safari, to make it run locally. To do this, just visit the webpage when you have internet then add it to the homepage, it will run fullscreen without an internet connection; it will work fine offline IF AND ONLY IF you don't need to connect for any data.

Database driven ios app - first steps

I'm about to start work on my first app which will be an internal release to gather customer information at a trade show.
I'm hopefully looking into using air for ios or maybe one of the various html/js frameworks to develop this app as an alternative to learning C.
ideally I would do it with some server based php > sql to store and share gathered information between a fleet of iPads, unfortunately due to the population of this trade show there will be no guarantee that i can maintain a wireless connection so need to prepare for these apps all being local access only.
in which case, how would you recommend going about the saving/reading of the stored data, and also how to sync it up with a sql server and then back to the iPads each night.
Did you try PhoneGap? It is an HTML5 app platform that allows you to author native applications with web technologies, in other words it will let you make an iphone app without having to learn C.
People have written tutorials and plugins for storing data locally.
PhoneGap basically wraps a web app hence you can use AJAX for sync with server as and when needed. This article might help.
We explored PhoneGap and found it very useful. and easy too. hope this helps you.