マニュアルのありか
https://docs.microsoft.com/en-us/azure/cognitive-services/custom-vision-service/home
/var/www/html/CVAPI_20170901
に
custom_vision_api_t********1.py
を作る。
########### Python 2.7 #############
import httplib, urllib, base64
headers = {
# Request headers
‘Content-Type’: ‘appl***********son’,
‘Prediction-key’: ‘5e68fe3********2edc352a3223d8’,
}
params = urllib.urlencode({
# Request parameters
‘iterationId’: ‘242e1c24-********-f9cde99ada30′,
#’application’: ‘octet********ream’,
})
imagefile = open(“./f********/L3.jpg”)
try:
conn = httplib.HTTPSConnection(********.microsoft.com’)
conn.request(“POST”, “/customvision/v1.0/Prediction/3a5ebacf-********/image?%s” % params, imagefile, headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print(“[Errno {0}] {1}”.format(e.errno, e.strerror))
####################################