Now, the image chosen from the gallery can be used as an input for the two prediction methods of the Cloud Vision API and TensorFlow Lite model. Next, let's define methods for running both of them.
Running image recognition
Using the Cloud Vision API
In this section, we simply define a visionAPICall method that is used to make an http Post request to the CloudVision API, passing in the request string encoded as json, which returns a json response that is parsed to get the values from the desired labels:
- First of all, we define an http plugin dependency in the pubspec.yaml file, as follows:
http: ^0.12.0+2
- Import the plugin in PlantSpeciesRecognition.dart to assist in making http requests, like...