def predict(url, appcode, img_base64, kv_config, old_format):
    if (not old_format):
        param = {'image': str(img_base64)}
        if (kv_config is not None):
            param['configure'] = json.dumps(kv_config)
        body = json.dumps(param)
    else:
        param = {}
        pic = {'dataType': 50, 'dataValue': img_base64}
        param['image'] = pic
        if (kv_config is not None):
            conf = {'dataType': 50, 'dataValue': json.dumps(kv_config)}
            param['configure'] = conf
        inputs = {'inputs': [param]}
        body = json.dumps(inputs)
    headers = {'Authorization': ('APPCODE %s' % appcode)}
    try:
        response = requests.get(url=url, headers=headers, data=body)
        return (response.code, response.headers, response.read())
    except Exception as e:
        return (e.code, e.headers, e.read())
def predict(url, appcode, img_base64, kv_config, old_format):
    if (not old_format):
        param = {'image': str(img_base64)}
        if (kv_config is not None):
            param['configure'] = json.dumps(kv_config)
        body = json.dumps(param)
    else:
        param = {}
        pic = {'dataType': 50, 'dataValue': img_base64}
        param['image'] = pic
        if (kv_config is not None):
            conf = {'dataType': 50, 'dataValue': json.dumps(kv_config)}
            param['configure'] = conf
        inputs = {'inputs': [param]}
        body = json.dumps(inputs)
    headers = {'Authorization': ('APPCODE %s' % appcode)}
    try:
        response = requests.get(url=url, headers=headers, data=body)
        return (response.code, response.headers, response.read())
    except Exception as e:
        return (e.code, e.headers, e.read())