• 微软人脸识别 php python js


    Cognitive Services
    https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a
    ########### php #############

    getUrl(); $headers = array( // Request headers 'Content-Type' => 'application/json', 'Ocp-Apim-Subscription-Key' => '{subscription key}', ); $request->setHeader($headers); $parameters = array( // Request parameters ); $url->setQueryVariables($parameters); $request->setMethod(HTTP_Request2::METHOD_POST); // Request body $request->setBody("{body}"); try { $response = $request->send(); echo $response->getBody(); } catch (HttpException $ex) { echo $ex; } ?>

    ########### Python 2.7 #############
    import httplib, urllib, base64

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

    params = urllib.urlencode({
    })

    try:
    conn = httplib.HTTPSConnection('westus.api.cognitive.microsoft.com')
    conn.request("POST", "/face/v1.0/verify?%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))

    ####################################

    ########### Python 3.2 #############
    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({
    })

    try:
    conn = http.client.HTTPSConnection('westus.api.cognitive.microsoft.com')
    conn.request("POST", "/face/v1.0/verify?%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))

    ####################################

    JSSample
    只为更好的服务;服务工作者。
  • 相关阅读:
    建造者模式
    模板方法模式
    抽象工厂模式
    工厂方法模式
    Josephus环问题
    单例模式
    求两个数的最大公约数
    Nginx的安装与部署
    左京大夫显辅
    java 调用第三方系统时的连接代码-记录
  • 原文地址:https://www.cnblogs.com/pony-mamba/p/13601048.html
Copyright © 2020-2023  润新知