Skip to content

Example client's code for work with Plant.id identification API in various languages

Notifications You must be signed in to change notification settings

jsten07/Plant-id-API

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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://web.plant.id/api-access-request/ --"
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

See the JSON response example.

More examples

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

About

Example client's code for work with Plant.id identification API in various languages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 27.4%
  • Java 19.9%
  • Rust 15.4%
  • JavaScript 14.4%
  • HTML 13.5%
  • PHP 9.4%