requirement.txt + fix

This commit is contained in:
zaqxs123456 2024-10-14 15:55:21 +08:00
parent 99049e22d1
commit 23fb1e836c
4 changed files with 17 additions and 11 deletions

18
app.py
View File

@ -31,7 +31,7 @@ def gen_image():
@app.route('/gen_group_pic', methods=['POST']) @app.route('/gen_group_pic', methods=['POST'])
def init_gen_group_pic(): def gen_group_pic():
if request.is_json: if request.is_json:
data = request.get_json() data = request.get_json()
coordinates_list = data['coordinates_list'] coordinates_list = data['coordinates_list']
@ -50,7 +50,7 @@ def init_gen_group_pic():
coordinates_list[i] = coordinates_list[i]['coordinates'] coordinates_list[i] = coordinates_list[i]['coordinates']
openpose_image_path = opg.save_bodypose_mulit(canvas_size[0], canvas_size[1], coordinates_list, pid) openpose_image_path = opg.save_bodypose_mulit(canvas_size[0], canvas_size[1], coordinates_list, pid)
# gen_group_pic(openpose_image_path, base_image, pid, opg.server_address) gen_group_pic_prompt(openpose_image_path, base_image, pid, opg.server_address)
return jsonify({"status": "success", "message": "Data received"}), 201 return jsonify({"status": "success", "message": "Data received"}), 201
else: else:
@ -63,7 +63,7 @@ def gen_fencer_prompt(openpose_image_path, pid, comfyUI_address):
prompt_json = f.read() prompt_json = f.read()
prompt = json.loads(prompt_json) prompt = json.loads(prompt_json)
openpose_image_name = opg.upload_image_circular_queue(openpose_image_path, 20, pid) openpose_image_name = opg.upload_image_circular_queue(openpose_image_path, 20, pid, comfyUI_address)
opg.upload_image("ref_black.png", "ref_black.png") opg.upload_image("ref_black.png", "ref_black.png")
prompt["3"]["inputs"]["seed"] = random.randint(0, 10000000000) prompt["3"]["inputs"]["seed"] = random.randint(0, 10000000000)
@ -72,17 +72,17 @@ def gen_fencer_prompt(openpose_image_path, pid, comfyUI_address):
opg.queue_prompt(prompt, comfyUI_address) opg.queue_prompt(prompt, comfyUI_address)
def gen_group_pic(openpose_image_path, base_image, pid, comfyUI_address): def gen_group_pic_prompt(openpose_image_path, base_image, pid, comfyUI_address):
with open("groupAPI.json", "r") as f: with open("group_pic.json", "r") as f:
prompt_json = f.read() prompt_json = f.read()
prompt = json.loads(prompt_json) prompt = json.loads(prompt_json)
openpose_image_name = opg.upload_image_circular_queue(openpose_image_path, 30, pid) openpose_image_name = opg.upload_image_circular_queue(openpose_image_path, 30, pid, comfyUI_address)
base_image_name = opg.upload_image_circular_queue(base_image, 30, pid) base_image_name = opg.upload_image_circular_queue(base_image, 30, pid, comfyUI_address)
prompt["3"]["inputs"]["seed"] = random.randint(0, 10000000000) prompt["3"]["inputs"]["seed"] = random.randint(0, 10000000000)
prompt["17"]["inputs"]['image'] = openpose_image_name prompt["10"]["inputs"]['image'] = openpose_image_name
prompt["17"]["inputs"]['image'] = base_image_name prompt["14"]["inputs"]['image'] = base_image_name
opg.queue_prompt(prompt, comfyUI_address) opg.queue_prompt(prompt, comfyUI_address)

View File

@ -14,6 +14,8 @@ import sys
import hashlib import hashlib
sys.path.append('./') sys.path.append('./')
server_address = "localhost:8188"
def is_normalized(keypoints: List[skel.Keypoint]) -> bool: def is_normalized(keypoints: List[skel.Keypoint]) -> bool:
for keypoint in keypoints: for keypoint in keypoints:
if not (0 <= keypoint.x <= 1 and 0 <= keypoint.y <= 1): if not (0 <= keypoint.x <= 1 and 0 <= keypoint.y <= 1):
@ -119,8 +121,6 @@ def save_bodypose_mulit(width: int, height: int, coordinates_list: list, pid: st
return image_path return image_path
server_address = "localhost:8188"
def queue_prompt(prompt, server_address): def queue_prompt(prompt, server_address):
p = {"prompt": prompt} p = {"prompt": prompt}
data = json.dumps(p).encode('utf-8') data = json.dumps(p).encode('utf-8')

View File

@ -1,18 +1,24 @@
blinker==1.8.2 blinker==1.8.2
certifi==2024.8.30
cffi==1.17.1 cffi==1.17.1
charset-normalizer==3.3.2
click==8.1.7 click==8.1.7
colorama==0.4.6 colorama==0.4.6
filelock==3.16.1 filelock==3.16.1
Flask==3.0.3 Flask==3.0.3
gevent==24.2.1 gevent==24.2.1
greenlet==3.1.1 greenlet==3.1.1
idna==3.10
itsdangerous==2.2.0 itsdangerous==2.2.0
Jinja2==3.1.4 Jinja2==3.1.4
MarkupSafe==2.1.5 MarkupSafe==2.1.5
numpy==2.1.1 numpy==2.1.1
opencv-python==4.10.0.84 opencv-python==4.10.0.84
pycparser==2.22 pycparser==2.22
requests==2.32.3
requests-toolbelt==1.0.0
setuptools==75.1.0 setuptools==75.1.0
urllib3==2.2.3
uuid==1.30 uuid==1.30
websocket==0.2.1 websocket==0.2.1
Werkzeug==3.0.4 Werkzeug==3.0.4

BIN
test.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB