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:
- 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 is used for processing streams of MIME multipart media types.
Now, we need to run flutter...