save code
This commit is contained in:
@@ -26,7 +26,7 @@ def queue_prompt(prompt):
|
|||||||
request.urlopen(req)
|
request.urlopen(req)
|
||||||
|
|
||||||
|
|
||||||
with open('/home/szlc/code/ComfyUI/change_cloth/basic_api.json', 'r', encoding='utf-8') as file:
|
with open('/home/xsl/code/ComfyUI/change_cloth/basic_api.json', 'r', encoding='utf-8') as file:
|
||||||
prompt_text = file.read()
|
prompt_text = file.read()
|
||||||
|
|
||||||
prompt = json.loads(prompt_text)
|
prompt = json.loads(prompt_text)
|
||||||
|
|||||||
+34
-22
@@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import uuid
|
import uuid
|
||||||
import requests
|
import requests
|
||||||
from flask import Flask, request, jsonify
|
from flask import Flask, request, jsonify, Response
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import json
|
import json
|
||||||
import base64
|
import base64
|
||||||
@@ -128,7 +128,7 @@ def takeoff_cloth_first(human_name, is_girl):
|
|||||||
if queue["queue_running"] or queue["queue_pending"]:
|
if queue["queue_running"] or queue["queue_pending"]:
|
||||||
return None, "cur gpu is busy"
|
return None, "cur gpu is busy"
|
||||||
|
|
||||||
with open('/home/szlc/code/ComfyUI/change_cloth/change_new.json', 'r', encoding='utf-8') as file:
|
with open('/home/xsl/code/ComfyUI/change_cloth/change_new.json', 'r', encoding='utf-8') as file:
|
||||||
prompt_text = file.read()
|
prompt_text = file.read()
|
||||||
|
|
||||||
prompt = json.loads(prompt_text)
|
prompt = json.loads(prompt_text)
|
||||||
@@ -186,7 +186,7 @@ def generate_from_face(human_name, sex_girl):
|
|||||||
if queue["queue_running"] or queue["queue_pending"]:
|
if queue["queue_running"] or queue["queue_pending"]:
|
||||||
return None, "cur gpu is busy"
|
return None, "cur gpu is busy"
|
||||||
|
|
||||||
with open('/home/szlc/code/ComfyUI/change_cloth/xiezhen_girl.json', 'r', encoding='utf-8') as file:
|
with open('/home/xsl/code/ComfyUI/change_cloth/xiezhen_girl.json', 'r', encoding='utf-8') as file:
|
||||||
prompt_text = file.read()
|
prompt_text = file.read()
|
||||||
|
|
||||||
prompt = json.loads(prompt_text)
|
prompt = json.loads(prompt_text)
|
||||||
@@ -256,16 +256,15 @@ def change(human_name, cloth_name, c_width, c_height, cloth_url, human_url, no2)
|
|||||||
print(f'不用第二部 no2{no2}')
|
print(f'不用第二部 no2{no2}')
|
||||||
else:
|
else:
|
||||||
print(f'要第二部 no2{no2} 先搞第一步')
|
print(f'要第二部 no2{no2} 先搞第一步')
|
||||||
# thigh_visible = is_thigh_visible(f"/home/szlc/code/ComfyUI/input/{human_name}")
|
if sgwzd >= 0.55:
|
||||||
if sgwzd >= 0.5:
|
|
||||||
#脱衣服
|
#脱衣服
|
||||||
takeoff_file_name = takeoff_cloth_first(human_name, sex_girl)
|
takeoff_file_name = takeoff_cloth_first(human_name, sex_girl)
|
||||||
if takeoff_file_name == None:
|
if takeoff_file_name == None:
|
||||||
return None, None, sex_girl, f"takeoff_cloth_first error {human_name}"
|
return None, None, sex_girl, f"takeoff_cloth_first error {human_name}"
|
||||||
else:
|
else:
|
||||||
human_name = takeoff_file_name
|
human_name = takeoff_file_name
|
||||||
takeoff_file_path_name = os.path.join('/home/szlc/code/ComfyUI/output', takeoff_file_name)
|
takeoff_file_path_name = os.path.join('/home/xsl/code/ComfyUI/output', takeoff_file_name)
|
||||||
takeoff_file_path_name_input = os.path.join('/home/szlc/code/ComfyUI/input', takeoff_file_name)
|
takeoff_file_path_name_input = os.path.join('/home/xsl/code/ComfyUI/input', takeoff_file_name)
|
||||||
shutil.copy(takeoff_file_path_name, takeoff_file_path_name_input)
|
shutil.copy(takeoff_file_path_name, takeoff_file_path_name_input)
|
||||||
else:
|
else:
|
||||||
#生成写真
|
#生成写真
|
||||||
@@ -274,8 +273,8 @@ def change(human_name, cloth_name, c_width, c_height, cloth_url, human_url, no2)
|
|||||||
return None, None, sex_girl, f"xiezhen error {human_name}"
|
return None, None, sex_girl, f"xiezhen error {human_name}"
|
||||||
else:
|
else:
|
||||||
human_name = generate_name
|
human_name = generate_name
|
||||||
generate_name_file_path_name = os.path.join('/home/szlc/code/ComfyUI/output', generate_name)
|
generate_name_file_path_name = os.path.join('/home/xsl/code/ComfyUI/output', generate_name)
|
||||||
generate_name_file_path_name_input = os.path.join('/home/szlc/code/ComfyUI/input', generate_name)
|
generate_name_file_path_name_input = os.path.join('/home/xsl/code/ComfyUI/input', generate_name)
|
||||||
shutil.copy(generate_name_file_path_name, generate_name_file_path_name_input)
|
shutil.copy(generate_name_file_path_name, generate_name_file_path_name_input)
|
||||||
|
|
||||||
queue = requests.get("http://localhost:8188/queue").json()
|
queue = requests.get("http://localhost:8188/queue").json()
|
||||||
@@ -283,7 +282,7 @@ def change(human_name, cloth_name, c_width, c_height, cloth_url, human_url, no2)
|
|||||||
return None, None, sex_girl, "cur gpu is busy, Shou not happen"
|
return None, None, sex_girl, "cur gpu is busy, Shou not happen"
|
||||||
|
|
||||||
print('开始换衣服')
|
print('开始换衣服')
|
||||||
with open('/home/szlc/code/ComfyUI/change_cloth/change_new.json', 'r', encoding='utf-8') as file:
|
with open('/home/xsl/code/ComfyUI/change_cloth/change_new.json', 'r', encoding='utf-8') as file:
|
||||||
prompt_text = file.read()
|
prompt_text = file.read()
|
||||||
|
|
||||||
prompt = json.loads(prompt_text)
|
prompt = json.loads(prompt_text)
|
||||||
@@ -360,13 +359,13 @@ def save_base64_image(base64_str, prefix):
|
|||||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
unique_id = str(uuid.uuid4())[:8]
|
unique_id = str(uuid.uuid4())[:8]
|
||||||
filename = f"{prefix}_{timestamp}_{unique_id}{file_ext}"
|
filename = f"{prefix}_{timestamp}_{unique_id}{file_ext}"
|
||||||
filepath = os.path.join('/home/szlc/code/ComfyUI/change_cloth/static/imgs', filename)
|
filepath = os.path.join('/home/xsl/code/ComfyUI/change_cloth/static/imgs', filename)
|
||||||
|
|
||||||
# 解码并保存图片
|
# 解码并保存图片
|
||||||
with open(filepath, 'wb') as f:
|
with open(filepath, 'wb') as f:
|
||||||
f.write(base64.b64decode(data))
|
f.write(base64.b64decode(data))
|
||||||
|
|
||||||
input_filepath = os.path.join('/home/szlc/code/ComfyUI/input', filename)
|
input_filepath = os.path.join('/home/xsl/code/ComfyUI/input', filename)
|
||||||
# 解码并保存图片
|
# 解码并保存图片
|
||||||
with open(input_filepath, 'wb') as f:
|
with open(input_filepath, 'wb') as f:
|
||||||
f.write(base64.b64decode(data))
|
f.write(base64.b64decode(data))
|
||||||
@@ -439,7 +438,7 @@ def upload_to_oss(image_path, object_name=None):
|
|||||||
|
|
||||||
|
|
||||||
def process_change_cloth(human_filename, cloth_filename, output_format, img_url, human_url, no2):
|
def process_change_cloth(human_filename, cloth_filename, output_format, img_url, human_url, no2):
|
||||||
w,h = get_image_dimensions(f'/home/szlc/code/ComfyUI/input/{human_filename}')
|
w,h = get_image_dimensions(f'/home/xsl/code/ComfyUI/input/{human_filename}')
|
||||||
|
|
||||||
out_put_name, out_human_name, is_girl, msg = change(human_filename, cloth_filename, w, h, img_url, human_url, no2)
|
out_put_name, out_human_name, is_girl, msg = change(human_filename, cloth_filename, w, h, img_url, human_url, no2)
|
||||||
if out_put_name == None:
|
if out_put_name == None:
|
||||||
@@ -449,18 +448,18 @@ def process_change_cloth(human_filename, cloth_filename, output_format, img_url,
|
|||||||
if no2:
|
if no2:
|
||||||
out_human_https_url = human_url
|
out_human_https_url = human_url
|
||||||
else:
|
else:
|
||||||
out_human_image = Image.open(f'/home/szlc/code/ComfyUI/output/{out_human_name}')
|
out_human_image = Image.open(f'/home/xsl/code/ComfyUI/output/{out_human_name}')
|
||||||
out_human_jpg_name = out_human_name.replace(".png", ".jpg")
|
out_human_jpg_name = out_human_name.replace(".png", ".jpg")
|
||||||
out_human_jpg_path_name = f'/home/szlc/code/ComfyUI/change_cloth/static/imgs/{out_human_jpg_name}'
|
out_human_jpg_path_name = f'/home/xsl/code/ComfyUI/change_cloth/static/imgs/{out_human_jpg_name}'
|
||||||
out_human_image.save(out_human_jpg_path_name, quality=95)
|
out_human_image.save(out_human_jpg_path_name, quality=95)
|
||||||
upload_to_oss(out_human_jpg_path_name, out_human_jpg_name) # 第二个参数可选,指定OSS上的路径
|
upload_to_oss(out_human_jpg_path_name, out_human_jpg_name) # 第二个参数可选,指定OSS上的路径
|
||||||
out_human_https_url = f'https://llyz.oss-cn-beijing.aliyuncs.com/{out_human_jpg_name}'
|
out_human_https_url = f'https://llyz.oss-cn-beijing.aliyuncs.com/{out_human_jpg_name}'
|
||||||
print(f"生成的第一步图片 HTTPS URL: {out_human_https_url}")
|
print(f"生成的第一步图片 HTTPS URL: {out_human_https_url}")
|
||||||
|
|
||||||
|
|
||||||
image = Image.open(f'/home/szlc/code/ComfyUI/output/{out_put_name}')
|
image = Image.open(f'/home/xsl/code/ComfyUI/output/{out_put_name}')
|
||||||
jpg_name = out_put_name.replace(".png", ".jpg")
|
jpg_name = out_put_name.replace(".png", ".jpg")
|
||||||
jpg_path_name = f'/home/szlc/code/ComfyUI/change_cloth/static/imgs/{jpg_name}'
|
jpg_path_name = f'/home/xsl/code/ComfyUI/change_cloth/static/imgs/{jpg_name}'
|
||||||
image.save(jpg_path_name, quality=95)
|
image.save(jpg_path_name, quality=95)
|
||||||
|
|
||||||
|
|
||||||
@@ -510,13 +509,13 @@ def save_image_from_url(image_url):
|
|||||||
# 获取原始图片格式
|
# 获取原始图片格式
|
||||||
ext = get_file_extension(image_url)
|
ext = get_file_extension(image_url)
|
||||||
filename = f"{uuid.uuid4()}{ext}"
|
filename = f"{uuid.uuid4()}{ext}"
|
||||||
filepath = os.path.join('/home/szlc/code/ComfyUI/change_cloth/static/imgs', filename)
|
filepath = os.path.join('/home/xsl/code/ComfyUI/change_cloth/static/imgs', filename)
|
||||||
|
|
||||||
with open(filepath, "wb") as f:
|
with open(filepath, "wb") as f:
|
||||||
for chunk in response.iter_content(1024):
|
for chunk in response.iter_content(1024):
|
||||||
f.write(chunk)
|
f.write(chunk)
|
||||||
|
|
||||||
input_filepath = os.path.join('/home/szlc/code/ComfyUI/input', filename)
|
input_filepath = os.path.join('/home/xsl/code/ComfyUI/input', filename)
|
||||||
shutil.copy(filepath, input_filepath)
|
shutil.copy(filepath, input_filepath)
|
||||||
|
|
||||||
return filename
|
return filename
|
||||||
@@ -655,7 +654,7 @@ def change_cloth_base64():
|
|||||||
return jsonify({"ret":-1, 'msg': 'Failed to save human image'}), 500
|
return jsonify({"ret":-1, 'msg': 'Failed to save human image'}), 500
|
||||||
data['human_img'] = None
|
data['human_img'] = None
|
||||||
|
|
||||||
human_url = f"http://112.126.94.241:18888/static/imgs/{human_filename}"
|
human_url = f"http://112.126.94.241:28888/static/imgs/{human_filename}"
|
||||||
|
|
||||||
# 保存服装图片
|
# 保存服装图片
|
||||||
cloth_filename = save_base64_image(cloth_img, 'cloth')
|
cloth_filename = save_base64_image(cloth_img, 'cloth')
|
||||||
@@ -663,7 +662,7 @@ def change_cloth_base64():
|
|||||||
return jsonify({"ret":-1, 'msg': 'Failed to save cloth image'}), 500
|
return jsonify({"ret":-1, 'msg': 'Failed to save cloth image'}), 500
|
||||||
data['cloth_img'] = None
|
data['cloth_img'] = None
|
||||||
|
|
||||||
cloth_url = f"http://112.126.94.241:18888/static/imgs/{cloth_filename}"
|
cloth_url = f"http://112.126.94.241:28888/static/imgs/{cloth_filename}"
|
||||||
|
|
||||||
data["human_url"] = human_url
|
data["human_url"] = human_url
|
||||||
data["cloth_url"] = cloth_url
|
data["cloth_url"] = cloth_url
|
||||||
@@ -672,7 +671,20 @@ def change_cloth_base64():
|
|||||||
if not no2:
|
if not no2:
|
||||||
data['no2'] = False
|
data['no2'] = False
|
||||||
|
|
||||||
return queueCall(data)
|
# 在内部调用第二个HTTP请求
|
||||||
|
try:
|
||||||
|
# 调用第二个API(可以是外部服务或自己的另一个端点)
|
||||||
|
response = requests.post('http://112.126.94.241:28888/do_change_cloth', json=data)
|
||||||
|
|
||||||
|
return Response(
|
||||||
|
response=response.content,
|
||||||
|
status=response.status_code,
|
||||||
|
headers=dict(response.headers)
|
||||||
|
)
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
data['second_api_error'] = str(e)
|
||||||
|
|
||||||
|
return jsonify("error"), 500
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
+1
-1
@@ -36,4 +36,4 @@ import mediapipe as mp
|
|||||||
|
|
||||||
# return left_thigh_visible and right_thigh_visible
|
# return left_thigh_visible and right_thigh_visible
|
||||||
|
|
||||||
# print(is_thigh_visible("/home/szlc/code/ComfyUI/change_cloth/static/imgs/fc74eded_00001_.jpg"))
|
# print(is_thigh_visible("/home/xsl/code/ComfyUI/change_cloth/static/imgs/fc74eded_00001_.jpg"))
|
||||||
@@ -4,7 +4,7 @@ import logging
|
|||||||
|
|
||||||
QUEUE_NAME = 'task_queue'
|
QUEUE_NAME = 'task_queue'
|
||||||
# 配置
|
# 配置
|
||||||
REDIS_HOST = '127.0.0.1'
|
REDIS_HOST = '192.168.101.118'
|
||||||
REDIS_PORT = 6379
|
REDIS_PORT = 6379
|
||||||
REDIS_DB = 0
|
REDIS_DB = 0
|
||||||
DEFAULT_TIMEOUT = (60*20)
|
DEFAULT_TIMEOUT = (60*20)
|
||||||
|
|||||||
+11
-11
@@ -56,7 +56,7 @@ def takeoff_cloth_first(human_name):
|
|||||||
if queue["queue_running"] or queue["queue_pending"]:
|
if queue["queue_running"] or queue["queue_pending"]:
|
||||||
return None, "cur gpu is busy"
|
return None, "cur gpu is busy"
|
||||||
|
|
||||||
with open('/home/szlc/code/ComfyUI/change_cloth/change_new.json', 'r', encoding='utf-8') as file:
|
with open('/home/xsl/code/ComfyUI/change_cloth/change_new.json', 'r', encoding='utf-8') as file:
|
||||||
prompt_text = file.read()
|
prompt_text = file.read()
|
||||||
|
|
||||||
prompt = json.loads(prompt_text)
|
prompt = json.loads(prompt_text)
|
||||||
@@ -122,15 +122,15 @@ def change(human_name, cloth_name, c_width, c_height, cloth_url, is_generated):
|
|||||||
return None, f"takeoff_cloth_first error {human_name}"
|
return None, f"takeoff_cloth_first error {human_name}"
|
||||||
else:
|
else:
|
||||||
human_name = takeoff_file_name
|
human_name = takeoff_file_name
|
||||||
takeoff_file_path_name = os.path.join('/home/szlc/code/ComfyUI/output', takeoff_file_name)
|
takeoff_file_path_name = os.path.join('/home/xsl/code/ComfyUI/output', takeoff_file_name)
|
||||||
takeoff_file_path_name_input = os.path.join('/home/szlc/code/ComfyUI/input', takeoff_file_name)
|
takeoff_file_path_name_input = os.path.join('/home/xsl/code/ComfyUI/input', takeoff_file_name)
|
||||||
shutil.copy(takeoff_file_path_name, takeoff_file_path_name_input)
|
shutil.copy(takeoff_file_path_name, takeoff_file_path_name_input)
|
||||||
|
|
||||||
queue = requests.get("http://localhost:8188/queue").json()
|
queue = requests.get("http://localhost:8188/queue").json()
|
||||||
if queue["queue_running"] or queue["queue_pending"]:
|
if queue["queue_running"] or queue["queue_pending"]:
|
||||||
return None, "cur gpu is busy"
|
return None, "cur gpu is busy"
|
||||||
|
|
||||||
with open('/home/szlc/code/ComfyUI/change_cloth/change_new.json', 'r', encoding='utf-8') as file:
|
with open('/home/xsl/code/ComfyUI/change_cloth/change_new.json', 'r', encoding='utf-8') as file:
|
||||||
prompt_text = file.read()
|
prompt_text = file.read()
|
||||||
|
|
||||||
prompt = json.loads(prompt_text)
|
prompt = json.loads(prompt_text)
|
||||||
@@ -207,13 +207,13 @@ def save_base64_image(base64_str, prefix):
|
|||||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
unique_id = str(uuid.uuid4())[:8]
|
unique_id = str(uuid.uuid4())[:8]
|
||||||
filename = f"{prefix}_{timestamp}_{unique_id}{file_ext}"
|
filename = f"{prefix}_{timestamp}_{unique_id}{file_ext}"
|
||||||
filepath = os.path.join('/home/szlc/code/ComfyUI/change_cloth/static/imgs', filename)
|
filepath = os.path.join('/home/xsl/code/ComfyUI/change_cloth/static/imgs', filename)
|
||||||
|
|
||||||
# 解码并保存图片
|
# 解码并保存图片
|
||||||
with open(filepath, 'wb') as f:
|
with open(filepath, 'wb') as f:
|
||||||
f.write(base64.b64decode(data))
|
f.write(base64.b64decode(data))
|
||||||
|
|
||||||
input_filepath = os.path.join('/home/szlc/code/ComfyUI/input', filename)
|
input_filepath = os.path.join('/home/xsl/code/ComfyUI/input', filename)
|
||||||
# 解码并保存图片
|
# 解码并保存图片
|
||||||
with open(input_filepath, 'wb') as f:
|
with open(input_filepath, 'wb') as f:
|
||||||
f.write(base64.b64decode(data))
|
f.write(base64.b64decode(data))
|
||||||
@@ -286,16 +286,16 @@ def upload_to_oss(image_path, object_name=None):
|
|||||||
|
|
||||||
|
|
||||||
def process_change_cloth(human_filename, cloth_filename, output_format, img_url, is_generated):
|
def process_change_cloth(human_filename, cloth_filename, output_format, img_url, is_generated):
|
||||||
w,h = get_image_dimensions(f'/home/szlc/code/ComfyUI/input/{human_filename}')
|
w,h = get_image_dimensions(f'/home/xsl/code/ComfyUI/input/{human_filename}')
|
||||||
|
|
||||||
out_put_name, msg = change(human_filename, cloth_filename, w, h, img_url, is_generated)
|
out_put_name, msg = change(human_filename, cloth_filename, w, h, img_url, is_generated)
|
||||||
if out_put_name == None:
|
if out_put_name == None:
|
||||||
print(f'Failed to change cloth {msg}')
|
print(f'Failed to change cloth {msg}')
|
||||||
return jsonify({"ret":-1, 'msg': f'Failed to change cloth {msg}'}), 200
|
return jsonify({"ret":-1, 'msg': f'Failed to change cloth {msg}'}), 200
|
||||||
|
|
||||||
image = Image.open(f'/home/szlc/code/ComfyUI/output/{out_put_name}')
|
image = Image.open(f'/home/xsl/code/ComfyUI/output/{out_put_name}')
|
||||||
jpg_name = out_put_name.replace(".png", ".jpg")
|
jpg_name = out_put_name.replace(".png", ".jpg")
|
||||||
jpg_path_name = f'/home/szlc/code/ComfyUI/change_cloth/static/imgs/{jpg_name}'
|
jpg_path_name = f'/home/xsl/code/ComfyUI/change_cloth/static/imgs/{jpg_name}'
|
||||||
image.save(jpg_path_name, quality=95)
|
image.save(jpg_path_name, quality=95)
|
||||||
|
|
||||||
|
|
||||||
@@ -376,13 +376,13 @@ def save_image_from_url(image_url):
|
|||||||
# 获取原始图片格式
|
# 获取原始图片格式
|
||||||
ext = get_file_extension(image_url)
|
ext = get_file_extension(image_url)
|
||||||
filename = f"{uuid.uuid4()}{ext}"
|
filename = f"{uuid.uuid4()}{ext}"
|
||||||
filepath = os.path.join('/home/szlc/code/ComfyUI/change_cloth/static/imgs', filename)
|
filepath = os.path.join('/home/xsl/code/ComfyUI/change_cloth/static/imgs', filename)
|
||||||
|
|
||||||
with open(filepath, "wb") as f:
|
with open(filepath, "wb") as f:
|
||||||
for chunk in response.iter_content(1024):
|
for chunk in response.iter_content(1024):
|
||||||
f.write(chunk)
|
f.write(chunk)
|
||||||
|
|
||||||
input_filepath = os.path.join('/home/szlc/code/ComfyUI/input', filename)
|
input_filepath = os.path.join('/home/xsl/code/ComfyUI/input', filename)
|
||||||
shutil.copy(filepath, input_filepath)
|
shutil.copy(filepath, input_filepath)
|
||||||
|
|
||||||
return filename
|
return filename
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ def upload_to_oss(image_path, object_name=None):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
# 使用示例
|
# 使用示例
|
||||||
image_path = '/home/szlc/code/ComfyUI/change_cloth/girl8010.jpg' # 本地图片路径
|
image_path = '/home/xsl/code/ComfyUI/change_cloth/girl8010.jpg' # 本地图片路径
|
||||||
upload_to_oss(image_path, 'girl8011.jpg') # 第二个参数可选,指定OSS上的路径
|
upload_to_oss(image_path, 'girl8011.jpg') # 第二个参数可选,指定OSS上的路径
|
||||||
https_url = f'https://llyz.oss-cn-beijing.aliyuncs.com/girl8011.jpg'
|
https_url = f'https://llyz.oss-cn-beijing.aliyuncs.com/girl8011.jpg'
|
||||||
print(f"生成的HTTPS URL: {https_url}")
|
print(f"生成的HTTPS URL: {https_url}")
|
||||||
|
|||||||
+1
-1
@@ -171,7 +171,7 @@
|
|||||||
console.log("准备发送的数据:", data); // 调试用
|
console.log("准备发送的数据:", data); // 调试用
|
||||||
|
|
||||||
// 调用API
|
// 调用API
|
||||||
fetch('http://112.126.94.241:18888/change_cloth_base64', {
|
fetch('http://112.126.94.241:28888/change_cloth_base64', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ import json
|
|||||||
|
|
||||||
# 1. 提交任务
|
# 1. 提交任务
|
||||||
|
|
||||||
with open('/home/szlc/code/ComfyUI/change_cloth/basic_api.json', 'r', encoding='utf-8') as file:
|
with open('/home/xsl/code/ComfyUI/change_cloth/basic_api.json', 'r', encoding='utf-8') as file:
|
||||||
prompt_text = file.read()
|
prompt_text = file.read()
|
||||||
|
|
||||||
prompt = json.loads(prompt_text)
|
prompt = json.loads(prompt_text)
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ def image_to_base64(file_path, mime_type=None):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
url = 'http://112.126.94.241:18018/change_cloth_base64'
|
url = 'http://112.126.94.241:18018/change_cloth_base64'
|
||||||
headers = {'Content-Type': 'application/json'}
|
headers = {'Content-Type': 'application/json'}
|
||||||
img64_human_str = image_to_base64("/home/szlc/code/ComfyUI/input/girl_full.jpg")
|
img64_human_str = image_to_base64("/home/xsl/code/ComfyUI/input/girl_full.jpg")
|
||||||
data = {}
|
data = {}
|
||||||
data['human_img'] = img64_human_str
|
data['human_img'] = img64_human_str
|
||||||
|
|
||||||
img64_cloth_str = image_to_base64("/home/szlc/code/ComfyUI/input/cloth_short.jpg")
|
img64_cloth_str = image_to_base64("/home/xsl/code/ComfyUI/input/cloth_short.jpg")
|
||||||
data['cloth_img'] = img64_cloth_str
|
data['cloth_img'] = img64_cloth_str
|
||||||
|
|
||||||
data['output_format'] = "url"
|
data['output_format'] = "url"
|
||||||
|
|||||||
Reference in New Issue
Block a user