• 百度技能问答模型


    import requests
    
    # client_id 为官网获取的AK, client_secret 为官网获取的SK
    host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=hIkC0fSxfQX17dGsbVcUGYzx&client_secret=wluN6dVLGjUlnyvxtiSzQzchrHnv4O2K'
    response = requests.get(host)
    if response:
        text_dict = response.json()
        access_token = text_dict['access_token']
        print(access_token)
    
    url = 'https://aip.baidubce.com/rpc/2.0/unit/bot/chat?access_token=' + access_token
    post_data = "{"bot_session":"","log_id":"7758521","request":{"bernard_level":1,"client_session":"{\"client_results\":\"\", \"candidate_options\":[]}","query":"格力空调价格怎么样?","query_info":{"asr_candidates":[],"source":"KEYBOARD","type":"TEXT"},"updates":"","user_id":"88888"},"bot_id":"1042747","version":"2.0"}".encode("utf-8")
    headers = {'content-type': 'application/x-www-form-urlencoded'}
    response = requests.post(url, data=post_data, headers=headers)
    if response:
        print (response.json())
    

      

  • 相关阅读:
    直方图均衡
    k-means聚类方法
    核函数
    支持向量机(SVM)
    函数的定义和调用
    ES5新增方法
    继承
    构造函数和原型
    面向对象版tab 栏切换
    ES6中的对象与类
  • 原文地址:https://www.cnblogs.com/LiuXinyu12378/p/13560232.html
Copyright © 2020-2023  润新知