Skip to content

Commit

Permalink
fixing merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonGaudert committed Feb 18, 2018
2 parents 658eebb + 27c86b1 commit 086c60c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
Binary file modified __pycache__/getImage.cpython-36.pyc
Binary file not shown.
Binary file modified __pycache__/naturalSpeech.cpython-36.pyc
Binary file not shown.
Binary file modified audioOutput.mp3
Binary file not shown.
2 changes: 1 addition & 1 deletion getImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ def get_image():#gets single image

cv2.imwrite(file, camera_capture)

del(camera)#deletes camera in order to create another later
del(camera)#deletes camera in order to create another later
Binary file modified snapShot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 14 additions & 11 deletions testAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ def sendWebRequest(image_url):
]
}'''
response = requests.post(url, data=data)

if(response.ok):
jData = json.loads(response.content)
if type == "WEB_DETECTION":
v_aReadings+=(jData['responses'][0]['webDetection']['webEntities'])
elif type == "LABEL_DETECTION":
v_aReadings+=(jData['responses'][0]['labelAnnotations'])


if(response.ok):
jData = json.loads(response.content)
if type == "WEB_DETECTION":
v_aReadings+=(jData['responses'][0]['webDetection']['webEntities'])
elif type == "LABEL_DETECTION":
v_aReadings+=(jData['responses'][0]['labelAnnotations'])
return v_aReadings

if __name__ == '__main__':
Expand All @@ -53,9 +52,13 @@ def sendWebRequest(image_url):
clean_string = encoded_image_string[2:(length-1)]
v_aReadings = sendWebRequest(clean_string)

number_of_labels = 0
for i in v_aReadings:
print (i['description'])

text = "I could be wrong, but my best guess is that you're looking at "+ v_aReadings[0]['description']+" or perhaps maybe " + v_aReadings[1]['description']
if i['description'][0].islower():
number_of_labels += 1
if v_aReadings[0]['score']>1:
text = "I could be wrong, but my best guess is that you're looking at "+ v_aReadings[0]['description']
else:
text = "I could be wrong, but my best guess is that you're looking at "+ v_aReadings[0]['description'] + " or perhaps maybe " + v_aReadings[len(v_aReadings)-number_of_labels]['description']

readText(text)

0 comments on commit 086c60c

Please sign in to comment.