コード例 #1
0
def test_labels(capsys):
    file_name = os.path.join(
        os.path.dirname(__file__),
        'resources/wakeupcat.jpg')
    detect.detect_labels(file_name)
    out, _ = capsys.readouterr()
    assert 'Labels' in out
コード例 #2
0
ファイル: app.py プロジェクト: rlalpha/Vision-on-raspberry
def detect_label():
    eye.take_photo()
    labels = detect.detect_labels("img/tmp.png")
    descriptions = [label.description for label in labels]
    str_concat = lambda x, y: x + ', ' + y
    items_msg = "I saw %s" % reduce(str_concat, descriptions)
    # js_response = json.dumps({'speech':items_msg, 'displayText':items_msg})
    # resp = Response(js_response, status=200, mimetype='application/json')
    #return resp
    return items_msg