tmp4.py 860 B

1234567891011121314151617181920212223242526272829303132
  1. import threading
  2. import requests
  3. import json
  4. # ernie-speed-128k
  5. # ernie_speed
  6. # ernie-lite-8k
  7. url = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-lite-8k?access_token=24.e83a74fae9d2c9989ee473fe50d8f1c4.2592000.1721975478.282335-87423633"
  8. payload = json.dumps({
  9. "messages": [
  10. {
  11. "role": "user",
  12. "content": "已知山药可以明目,已知黄连可以明目,根据上述信息,请问什么明目?不要解释,直接回答"
  13. }
  14. ]
  15. })
  16. headers = {
  17. 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
  18. 'Content-Type': 'application/json'
  19. }
  20. def getRes():
  21. print(1)
  22. response = requests.request("POST", url, headers=headers, data=payload)
  23. print(json.loads(response.text)['result'])
  24. # 并发5 ,访问
  25. for i in range(5):
  26. threading.Thread(target=getRes).start()