temp.py 1.1 KB

1234567891011121314151617181920212223242526
  1. # from PIL import Image
  2. # from settings import recordDataPoint
  3. import time
  4. from service.online_request.module_online_data import OnlineDataRequest,AIGCDataRequest
  5. aigc = AIGCDataRequest("Bearer f99e72d818b504d23e0581ef1b1a2b4bb687c683")
  6. # status, result_image = aigc.searchProgress(1127984)
  7. # print(status,result_image)
  8. search_times = 60
  9. while search_times > 0:
  10. print(f"模特图查询第{search_times}次")
  11. # logger.info(f"模特图查询第{search_times}次")
  12. status, result_image = aigc.searchProgress(1127989)
  13. # status: -1=失败, 0=排队中, 1=进行中, 2=完成
  14. if status == 2: # 完成
  15. break
  16. if status == -1: # 失败
  17. break
  18. # status为0(排队中)或1(进行中)时继续查询
  19. time.sleep(1)
  20. search_times -= 1
  21. # 循环结束后检查最终状态
  22. if status == -1 or (status != 2 and search_times <= 0):
  23. print("模特图生成失败")
  24. exit()
  25. # save_image_path = download_image_with_pil(result_image, save_path)
  26. print("上脚图save_image_path",result_image)