officinearduinotorino / ruralhack Goto Github PK
View Code? Open in Web Editor NEWA place to store all the code and information for the RuralHack Workshop
A place to store all the code and information for the RuralHack 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 |
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.
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"]
request_id = send_for_identificattion(['photo1.jpg','photo2.jpg'])
for suggestion in get_suggestions(request_id):
print(suggestion["plant"]["name"])
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.