Skip to content
Example client's code for work with Plant.id identification API in various languages
Python
Branch: master
Clone or download

Latest commit

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
python Add example of asynchronous identification Mar 10, 2020
README.md Fix the possible meaning ambiguity Mar 23, 2020

README.md

Plant.id offers a plant identification service based on machine learning. Once you obtain the API key, you can use these client's code to speed-up the development of your implementation.

Plant.id API v2

Documentation

See our documentation for the full reference.

Simple Python example

import base64
import requests

# encode image to base64
with open("unknown_plant.jpg", "rb") as file:
    images = [base64.b64encode(file.read()).decode("ascii")]

your_api_key = "fd3slj47dj... -- ask for one: https://forms.gle/yK1AY53YkYJjsc8X8 --"
json_data = {
    "images": images,
    "modifiers": ["similar_images"],
    "plant_details": ["common_names", "url", "wiki_description", "taxonomy"]
}

response = requests.post(
    "https://api.plant.id/v2/identify",
    json=json_data,
    headers={
        "Content-Type": "application/json",
        "Api-Key": your_api_key
    }).json()

for suggestion in response["suggestions"]:
    print(suggestion["plant_name"])    # Taraxacum officinale
    print(suggestion["plant_details"]["common_names"])    # ["Dandelion"]
    print(suggestion["plant_details"]["url"])    # https://en.wikipedia.org/wiki/Taraxacum_officinale

More examples

Don't know how to code? Try the online demo.

You can’t perform that action at this time.