sd_comfy_deadline.py 953 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import requests
  2. DDL_SERVER = "http://69.230.251.234:8081/api"
  3. script_path = "D://Git//ap-canvas-creation-module//04_stable_diffusion//sd_comfy_api.py"
  4. def send_sd_comfy_ddl_job(
  5. job_info={
  6. "Plugin": "Python",
  7. "Priority": 49,
  8. "Name": "ComfyUI Job",
  9. "Group": "general",
  10. # "PostJobScript": "C:/WORK/2022.DDL_Script/postJobTest.py",
  11. },
  12. plugin_info={"ScriptFile": script_path, "Version": "3.1"},
  13. ):
  14. url = f"{DDL_SERVER}/jobs"
  15. data = {
  16. "JobInfo": job_info,
  17. "PluginInfo": plugin_info,
  18. "AuxFiles": [],
  19. "IdOnly": True,
  20. }
  21. response = requests.post(url, json=data)
  22. if response.status_code == 200:
  23. print("Data posted successfully.")
  24. return response.json()
  25. else:
  26. print(f"Failed to post data. Status code: {response.status_code}")
  27. return None
  28. job = send_sd_comfy_ddl_job()
  29. job_id = job["_id"]
  30. print(f"Job ID: {job_id}")