Compare commits
2
Commits
32db459b24
...
2280e59398
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2280e59398 | ||
|
|
c76eae5d39 |
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+15
-11
@@ -3,7 +3,7 @@ import os, oss2, time, redis, requests, shutil, sys, subprocess, json, platform
|
|||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
from retrying import retry
|
from retrying import retry
|
||||||
import atexit,platform
|
import atexit,platform
|
||||||
import white_purification_v1
|
import white_purification_v2,white_purification
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == 'Windows':
|
||||||
sys.path.append('e:\\libs\\')
|
sys.path.append('e:\\libs\\')
|
||||||
import common
|
import common
|
||||||
@@ -124,17 +124,7 @@ def team_check(r):
|
|||||||
|
|
||||||
print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), f'pid:{pid} repair_id:{repair_id} 生成团队审核模型 start model:IndependentRepairTeamcheckGLBQueue', )
|
print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), f'pid:{pid} repair_id:{repair_id} 生成团队审核模型 start model:IndependentRepairTeamcheckGLBQueue', )
|
||||||
ossPath = down_obj_fromoss(pid,orderId)
|
ossPath = down_obj_fromoss(pid,orderId)
|
||||||
#对文件进行白色提纯处理
|
|
||||||
imagePath = os.path.join(workdir, 'print', pid,pid+"Tex1.jpg")
|
|
||||||
print("开始处理白色提纯")
|
|
||||||
#white_purification_v1.white_purification_utils(imagePath)
|
|
||||||
os.system(f'python d:\\make2\\apps\white_purification_v1.py.py -i {imagePath}')
|
|
||||||
|
|
||||||
print("贴图文件白色提纯完成",imagePath)
|
|
||||||
#提纯完重新上传提纯图片
|
|
||||||
ossImagePath = os.path.join("objs/print", pid,ossPath,"texture","process_"+pid+"Tex1.jpg")
|
|
||||||
oss_client.put_object_from_file(f"objs/print/{pid}/{ossPath}/texture/process_{pid}Tex1.jpg",imagePath)
|
|
||||||
print("白色提纯上传图片路径-",ossImagePath,imagePath)
|
|
||||||
|
|
||||||
obj_filename = f'{pid}.obj'
|
obj_filename = f'{pid}.obj'
|
||||||
glb_filename = f'{orderId}.glb'
|
glb_filename = f'{orderId}.glb'
|
||||||
@@ -158,6 +148,20 @@ def team_check(r):
|
|||||||
|
|
||||||
oss_client.put_object_from_file(f'glbs/print/order_id/{glb_filename}', os.path.join(workdir, "print", pid, glb_filename))
|
oss_client.put_object_from_file(f'glbs/print/order_id/{glb_filename}', os.path.join(workdir, "print", pid, glb_filename))
|
||||||
|
|
||||||
|
#对文件进行白色提纯处理
|
||||||
|
imagePath = os.path.join(workdir, 'print', pid,pid+"Tex1.jpg")
|
||||||
|
print("开始处理白色提纯")
|
||||||
|
#white_purification.white_purification_utils(imagePath)
|
||||||
|
os.system(f'python D:\\make2\\apps\white_purification_v2.py -i {imagePath}')
|
||||||
|
|
||||||
|
print("贴图文件白色提纯完成",imagePath)
|
||||||
|
#提纯完重新上传提纯图片
|
||||||
|
ossImagePath = os.path.join("objs/print", pid,ossPath,"texture","process_"+pid+"Tex1.jpg")
|
||||||
|
oss_client.put_object_from_file(f"objs/print/{pid}/{ossPath}/texture/process_{pid}Tex1.jpg",imagePath)
|
||||||
|
print("白色提纯上传图片路径-",ossImagePath,imagePath)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print(f'{update_repair_status_url}?id={repair_id}')
|
print(f'{update_repair_status_url}?id={repair_id}')
|
||||||
res = requests.get(f'{update_repair_status_url}?id={repair_id}')
|
res = requests.get(f'{update_repair_status_url}?id={repair_id}')
|
||||||
print('更新团队审核状态:', res.text)
|
print('更新团队审核状态:', res.text)
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ if __name__ == "__main__":
|
|||||||
os.makedirs(image_result_dir, exist_ok=True)
|
os.makedirs(image_result_dir, exist_ok=True)
|
||||||
|
|
||||||
start_time= time.time()
|
start_time= time.time()
|
||||||
correct_texture_image(args.input_path,image_result_dir,args.image_path)
|
correct_texture_image(args.image_path,image_result_dir,args.image_path)
|
||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
total_time = round(end_time - start_time, 2)
|
total_time = round(end_time - start_time, 2)
|
||||||
print(f"处理成功,耗时 {total_time} 秒,")
|
print(f"处理成功,耗时 {total_time} 秒,")
|
||||||
|
|||||||
+12145
-1
File diff suppressed because it is too large.
Load diff
+15
-30
@@ -33,35 +33,20 @@ def main(pid,orderId,styleNumber):
|
|||||||
print("弹出版本选择按钮已成功点击")
|
print("弹出版本选择按钮已成功点击")
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
# 使用XPath定位包含特定文本的div元素
|
# 使用XPath定位包含特定文本的div元素
|
||||||
target_text = "3.小鱼AI(灰度图)图片浮雕流程-V3"
|
target_text = "深度图批处理"
|
||||||
button = WebDriverWait(driver, 10).until(
|
button = WebDriverWait(driver, 10).until(
|
||||||
EC.element_to_be_clickable((By.XPATH, f'//div[contains(text(), "{target_text}")]'))
|
EC.element_to_be_clickable((By.XPATH, f'//div[contains(text(), "{target_text}")]'))
|
||||||
)
|
)
|
||||||
button.click()
|
button.click()
|
||||||
print("选择版本按钮已成功点击")
|
print("选择版本按钮已成功点击")
|
||||||
|
time.sleep(3)
|
||||||
#通过url上传文件
|
# 使用XPath定位包含特定文本的div元素
|
||||||
url = f"http://127.0.0.1:8188/api/upload/image"
|
target_text = "Extra options"
|
||||||
imagePath = os.path.join(inputFolder, f"{pid}_{orderId}_{styleNumber}.png")
|
button = WebDriverWait(driver, 10).until(
|
||||||
with open(imagePath, 'rb') as f:
|
EC.element_to_be_clickable((By.XPATH, f'//label[contains(text(), "{target_text}")]'))
|
||||||
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()
|
button.click()
|
||||||
time.sleep(5)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
button = driver.find_element(By.ID, 'queue-button')
|
button = driver.find_element(By.ID, 'queue-button')
|
||||||
@@ -157,7 +142,8 @@ def checkIsFinish(driver, pid, orderId,styleNumber):
|
|||||||
print(f"pid={pid},orderid={orderId},style_number:{styleNumber} 任务处理完成,深度图已上传到OSS")
|
print(f"pid={pid},orderid={orderId},style_number:{styleNumber} 任务处理完成,深度图已上传到OSS")
|
||||||
#推入到队列中
|
#推入到队列中
|
||||||
r = utils.create_redis_connection()
|
r = utils.create_redis_connection()
|
||||||
r.lpush('model:badge_cartoon_build', json.dumps({'pid': pid, 'order_id': orderId, 'style_number': styleNumber}))
|
if pid > 1000:
|
||||||
|
r.lpush('model:badge_cartoon_build', json.dumps({'pid': pid, 'order_id': orderId, 'style_number': styleNumber}))
|
||||||
|
|
||||||
driver.quit()
|
driver.quit()
|
||||||
return True
|
return True
|
||||||
@@ -189,7 +175,7 @@ if __name__ == '__main__':
|
|||||||
orderId = 0
|
orderId = 0
|
||||||
styleNumber = 0
|
styleNumber = 0
|
||||||
downloadPath = "D:\downloadPhotos"
|
downloadPath = "D:\downloadPhotos"
|
||||||
inputFolder = "C:\StableDiffusion_xiaoyu_V3\ComfyUI-aki-v1.6-XY\ComfyUI\input"
|
inputFolder = "c:\deep" #"C:\StableDiffusion_xiaoyu_V3\ComfyUI-aki-v1.6-XY\ComfyUI\input"
|
||||||
outputFolder = "C:\StableDiffusion_xiaoyu_V3\ComfyUI-aki-v1.6-XY\ComfyUI\output"
|
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"
|
jsonFilePath = "C:\StableDiffusion_xiaoyu_V3\ComfyUI-aki-v1.6-XY\ComfyUI\pysssss-workflows"
|
||||||
# 设置浏览器驱动路径(以Chrome为例)
|
# 设置浏览器驱动路径(以Chrome为例)
|
||||||
@@ -221,12 +207,12 @@ if __name__ == '__main__':
|
|||||||
r = utils.create_redis_connection()
|
r = utils.create_redis_connection()
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
if r.llen('model:badge_cartoon_test') == 0:
|
# if r.llen('model:badge_cartoon') == 0:
|
||||||
print('队列为空,等待10秒')
|
# print('队列为空,等待10秒')
|
||||||
time.sleep(10)
|
# time.sleep(10)
|
||||||
continue
|
# continue
|
||||||
|
|
||||||
info = r.lpop('model:badge_cartoon_test')
|
info = r.spop('model:badge_cartoon')
|
||||||
if info is None:
|
if info is None:
|
||||||
print('队列为空,等待10秒')
|
print('队列为空,等待10秒')
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
@@ -251,7 +237,6 @@ if __name__ == '__main__':
|
|||||||
print(f"pid:{pid} orderId:{orderId} style_number:{styleNumber}")
|
print(f"pid:{pid} orderId:{orderId} style_number:{styleNumber}")
|
||||||
if pid > 0 and orderId > 0 and styleNumber > 0:
|
if pid > 0 and orderId > 0 and styleNumber > 0:
|
||||||
main(pid,orderId,styleNumber)
|
main(pid,orderId,styleNumber)
|
||||||
break
|
|
||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
print(f'JSON解析错误:{e}')
|
print(f'JSON解析错误:{e}')
|
||||||
utils.notify(f'JSON解析错误:{e}')
|
utils.notify(f'JSON解析错误:{e}')
|
||||||
|
|||||||
Binary file not shown.
Reference in new issue
Block a user