aci-demos icon indicating copy to clipboard operation
aci-demos copied to clipboard

implement captionbot

Open rbitia opened this issue 7 years ago • 2 comments

https://github.com/dylang/captionbot spin off containers to caption each picture w/ a face and then post them on twitter and then delete the container

rbitia avatar Oct 13 '17 13:10 rbitia

actually gonna try MS cognitive services 4 this

rbitia avatar Oct 13 '17 13:10 rbitia

import http.client, urllib.request, urllib.parse, urllib.error, base64

headers = { # Request headers 'Content-Type': 'application/json', 'Ocp-Apim-Subscription-Key': '{subscription key}', }

params = urllib.parse.urlencode({ # Request parameters 'visualFeatures': 'Categories', 'details': '{string}', 'language': 'en', })

try: conn = http.client.HTTPSConnection('westus.api.cognitive.microsoft.com') conn.request("POST", "/vision/v1.0/analyze?%s" % params, "{body}", headers) response = conn.getresponse() data = response.read() print(data) conn.close() except Exception as e: print("[Errno {0}] {1}".format(e.errno, e.strerror))

rbitia avatar Oct 13 '17 13:10 rbitia