Beispiel #1
0
def query_resemble_images_by_url():
    image_url = request.form['param']

    result = img_lib.query(image_url=image_url)
    result = map(lambda (key, value): (_hex(key), value), result)
    print result

    return jsonify(result=result)
Beispiel #2
0
def query_resemble_images_by_hash():
    image_hash = request.form['param']
    base = 10
    if image_hash.startswith('0b'):
        base = 2
    elif image_hash.startswith('0x'):
        base = 16
    elif image_hash.startswith('0o'):
        base = 8
    image_hash = int(image_hash, base=base)

    result = img_lib.query(image_hash=image_hash)
    result = map(lambda (key, value): (_hex(key), value), result)
    print result

    return jsonify(result=result)