diff --git a/comfyui/main.py b/comfyui/main.py index 1658dbb..c6e75d7 100644 --- a/comfyui/main.py +++ b/comfyui/main.py @@ -6,6 +6,7 @@ from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import time,os,sys,oss2,json,shutil from util import utils +import requests def main(pid,orderId,styleNumber): @@ -38,6 +39,29 @@ def main(pid,orderId,styleNumber): ) button.click() print("选择版本按钮已成功点击") + + #通过url上传文件 + url = f"http://127.0.0.1:8188/api/upload/image" + imagePath = os.path.join(inputFolder, f"{pid}_{orderId}_{styleNumber}.png") + with open(imagePath, 'rb') as f: + files = {'file': f} + response = requests.post(url, files=files) + print(response.json()) + + + + + + time.sleep(5) + #点击上传按钮 + button = driver.find_element(By.ID, 'upload-button') + button.click() + time.sleep(5) + + + + + # time.sleep(5) button = driver.find_element(By.ID, 'queue-button') @@ -164,6 +188,7 @@ if __name__ == '__main__': pid = 0 orderId = 0 styleNumber = 0 + downloadPath = "D:\downloadPhotos" inputFolder = "C:\StableDiffusion_xiaoyu_V3\ComfyUI-aki-v1.6-XY\ComfyUI\input" outputFolder = "C:\StableDiffusion_xiaoyu_V3\ComfyUI-aki-v1.6-XY\ComfyUI\output" jsonFilePath = "C:\StableDiffusion_xiaoyu_V3\ComfyUI-aki-v1.6-XY\ComfyUI\pysssss-workflows" @@ -177,6 +202,8 @@ if __name__ == '__main__': os.makedirs(outputFolder) if not os.path.exists(jsonFilePath): os.makedirs(jsonFilePath) + if not os.path.exists(downloadPath): + os.makedirs(downloadPath)