Git Product home page Git Product logo

ruralhack's People

Contributors

afibot avatar harmvanbeek avatar kliment avatar vongomben avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruralhack's Issues

Grove connectors: wrong pin spacing

Hi, pin spacing for the Grove connectors is 2mm.
The pin spacing in the board is the standard 2.54mm instead, so a connector doesn't fit unless you bend its pins.

Interesting APIs to talk to in the workshop

From Programmable WEB:

Name Description Link Status
OpenWeatherMap Weather Forecast (Global) https://openweathermap.org/ Account Created
plant.id Identify your plants. (CV) https://api.plant.id/ Received Token
trefle.io The Trefle API in REST architecture supports JSON format to return botanical data for plant species. https://trefle.io/reference Account Created
deepgreen Plant Diagnosis API The deepgreen Plant Diagnosis API is used to detect pests, diseases, and nutrient deficiencies in crops. https://www.deepgreen.ai/#plant-diagnosis-api Applied

Create a Node-RED node able to interact with Plant.id

the call is based on this Documentation

`
"""
The purpose of this code is to show how to work with plant.id API.
You'll find API documentation at https://plantid.docs.apiary.io and https://plant.id/api
"""

import base64
import requests
from time import sleep

secret_access_key = '-- ask for one at [email protected] --'

def send_for_identificattion(file_names):
files_encoded = []
for file_name in file_names:
with open(file_name, 'rb') as file:
files_encoded.append(base64.b64encode(file.read()).decode('ascii'))

params = {
	'latitude': 49.194161,
	'longitude': 16.603017,
	'week': 23,
	'images': files_encoded,
	'key': secret_access_key,
	'parameters': ["crops_fast"]
}
# see the docs for more optinal atrributes; for example 'custom_id' allows you to work
# with your own identifiers
headers = {
	'Content-Type': 'application/json'
}

response = requests.post('https://plant.id/api/identify', json=params, headers=headers)

if response.status_code != 200:
    raise("send_for_identificattion error: {}".format(response.text))

# this reference allows you to gather the identification result (once its ready)
return response.json().get('id')

def get_suggestions(request_id):
params = {
"key": secret_access_key,
"ids": [request_id]
}
headers = {
'Content-Type': 'application/json'
}

# To keep it simple, we are pooling the API waiting for the server to finish the identification.
# The better way would be to utilise "callback_url" parameter in /identify call to tell the our server 
# to call your's server enpoint once the identificatin is done.
while True:
	print("Waiting for suggestions...")
	sleep(5)
	resp = requests.post('https://plant.id/api/check_identifications', json=params, headers=headers).json()
	if resp[0]["suggestions"]:
		return resp[0]["suggestions"]

more photos of the same plant increases the accuracy

request_id = send_for_identificattion(['photo1.jpg','photo2.jpg'])

just listing the suggested plant names here (without the certainty values)

for suggestion in get_suggestions(request_id):
print(suggestion["plant"]["name"])
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.