Bash Examples

Example: Post an image and a json to our image API.

This is a very basic example script, using curl, to post pictures to a our image API. You find a more examples here in our GitHub Repo. There are also more images for testing from our validation dataset in this repo.  

Single image processing

If you want to process a single image, you can use the following code snippet as basis for your application. Just replace the the string "" with your api key.

1
2
3
#!/bin/bash
# replace <YOUR_API_KEY> with a valid key
curl -H "api_key: <YOUR_API_KEY>" -F "picture=@../data/Wheat_Leaf_Rust_100059/PEAT_20160609_122425_85d9410f-5452-42da-b471-2d80a4e9d94e.jpg" "https://api.peat-cloud.com/v1/image_analysis"

Batch Processing

For a bash example, just use the above example and run it in a loop, that iterates over all your images.

API response

the response on a valid API call would look like this

{ u'code': 200,
u'recognized': u'True',
    u'image_analysis':  [{
        u'peat_id': 100095,
        u'name': u'Rhynchosporium',
        u'rank': 1,
        u'similarity': 85
        }]
}