tryOn.py 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. import requests
  2. url = 'https://dashscope.aliyuncs.com/api/v1/services/aigc/virtualmodel/generation/'
  3. DASHSCOPE_API_KEY = "sk-36a7725c51be4ffe8d3374ea534014b6"
  4. headers = {
  5. 'X-DashScope-Async': 'enable',
  6. 'Authorization': f'Bearer {DASHSCOPE_API_KEY}', # 确保你已经设置了 DASHSCOPE_API_KEY
  7. 'Content-Type': 'application/json'
  8. }
  9. data = {
  10. "model": "shoemodel-v1",
  11. "input": {
  12. "template_image_url": "https://infish-oss.oss-cn-beijing.aliyuncs.com/test/model2.jpg",
  13. "shoe_image_url": ["https://infish-oss.oss-cn-beijing.aliyuncs.com/test/shoe3.png"]
  14. },
  15. "parameters": {
  16. "n": 1
  17. }
  18. }
  19. task_id = "6488c66d-2a0c-4134-90bb-39ab957d6cdf"
  20. returl = f'https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}'
  21. headersret = {
  22. 'Authorization': f'Bearer {DASHSCOPE_API_KEY}', # 确保你已经设置了 DASHSCOPE_API_KEY
  23. }
  24. # response = requests.post(url, headers=headers, json=data)
  25. # print(response.json())
  26. response = requests.get(returl, headers=headersret)
  27. print(response.json())