Integrating a hosted custom model on Flutter

In this section, we will make a POST request to the hosted model and pass it in the image selected by the user. The server will respond with a NetworkImage in PNG format. Then, we'll update the image widget we added earlier to show the enhanced image that's returned by the model.

Let's start integrating the hosted model into the application:

  1. First of all, we will need two more external libraries to make a successful POST request. Therefore, we'll add the following libraries as dependencies to the pubspec.yaml file:
dependencies:     flutter:          http: 0.12.0+4          mime: 0.9.6+3

The http dependency contains a set of classes and functions that make consuming HTTP resources very convenient. The mime dependency ...

Get Mobile Deep Learning with TensorFlow Lite, ML Kit and Flutter now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.