Compare commits
No commits in common. "a46b76f76d4213f9183b3323e877014ce06f52bd" and "aa18570341da8e4c33ebbdc81b13c1bab489fb33" have entirely different histories.
a46b76f76d
...
aa18570341
|
|
@ -85,9 +85,9 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||||
"Jinja2RenderTemplate": "Jinja2格式Prompt模板渲染",
|
"Jinja2RenderTemplate": "Jinja2格式Prompt模板渲染",
|
||||||
"JMGestureCorrect": "人物侧身图片转为正面图-即梦",
|
"JMGestureCorrect": "人物侧身图片转为正面图-即梦",
|
||||||
"ModalClothesMask": "模特指定衣服替换为指定颜色",
|
"ModalClothesMask": "模特指定衣服替换为指定颜色",
|
||||||
"ModalEditCustom": "Prompt生/修图-Gemini",
|
"ModalEditCustom": "Prompt生/修图",
|
||||||
"ModalMidJourneyGenerateImage": "Prompt生/修图-MJ",
|
"ModalMidJourneyGenerateImage": "Prompt生/修图",
|
||||||
"ModalMidJourneyDescribeImage": "反推生图提示词-MJ",
|
"ModalMidJourneyDescribeImage": "反推生图提示词",
|
||||||
"JMCustom": "Prompt生视频",
|
"JMCustom": "Prompt生视频",
|
||||||
"VideoMerge":"顺序合并视频"
|
"VideoMerge":"顺序合并视频"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,6 @@ image = (
|
||||||
.run_commands("comfy node install https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes.git")
|
.run_commands("comfy node install https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes.git")
|
||||||
.run_commands("comfy node install https://github.com/jamesWalker55/comfyui-various.git")
|
.run_commands("comfy node install https://github.com/jamesWalker55/comfyui-various.git")
|
||||||
.run_commands("comfy node install https://gitea.bowongai.com/Polaris/ComfyUI-CustomNode.git")
|
.run_commands("comfy node install https://gitea.bowongai.com/Polaris/ComfyUI-CustomNode.git")
|
||||||
.run_commands("comfy node install https://github.com/rgthree/rgthree-comfy.git")
|
|
||||||
.run_commands("comfy node install https://github.com/yuvraj108c/ComfyUI-Dwpose-Tensorrt")
|
|
||||||
.run_commands("comfy node install https://github.com/kijai/ComfyUI-DepthAnythingV2")
|
|
||||||
.pip_install("sageattention")
|
.pip_install("sageattention")
|
||||||
.run_commands("rm -rf /root/comfy/ComfyUI/models&&ln -s /models /root/comfy/ComfyUI/models")
|
.run_commands("rm -rf /root/comfy/ComfyUI/models&&ln -s /models /root/comfy/ComfyUI/models")
|
||||||
.run_commands("rm -rf /root/comfy/ComfyUI/input&&ln -s /models/input /root/comfy/ComfyUI/input")
|
.run_commands("rm -rf /root/comfy/ComfyUI/input&&ln -s /models/input /root/comfy/ComfyUI/input")
|
||||||
|
|
@ -61,25 +58,16 @@ vol = modal.Volume.from_name("comfy_model", environment_name="dev", create_if_mi
|
||||||
def ui_1():
|
def ui_1():
|
||||||
subprocess.Popen("comfy launch -- --listen 0.0.0.0 --port 8000", shell=True)
|
subprocess.Popen("comfy launch -- --listen 0.0.0.0 --port 8000", shell=True)
|
||||||
|
|
||||||
@app.function(
|
# @app.function(
|
||||||
cpu=(4, 64),
|
# max_containers=1,
|
||||||
memory=(4096, 131072),
|
# secrets=[custom_secret]
|
||||||
min_containers=0,
|
# )
|
||||||
buffer_containers=0,
|
# @modal.concurrent(
|
||||||
max_containers=1,
|
# max_inputs=10
|
||||||
gpu="L40S:3",
|
# )
|
||||||
scaledown_window=600,
|
# @modal.web_server(8000, startup_timeout=60)
|
||||||
secrets=[custom_secret],
|
# def ui_2():
|
||||||
volumes={
|
# subprocess.Popen("comfy launch -- --cpu --listen 0.0.0.0 --port 8000", shell=True)
|
||||||
"/models": vol
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@modal.concurrent(
|
|
||||||
max_inputs=20
|
|
||||||
)
|
|
||||||
@modal.web_server(8000, startup_timeout=60)
|
|
||||||
def ui_2():
|
|
||||||
subprocess.Popen("comfy launch -- --listen 0.0.0.0 --port 8000", shell=True)
|
|
||||||
#
|
#
|
||||||
# @app.function(
|
# @app.function(
|
||||||
# max_containers=1,
|
# max_containers=1,
|
||||||
|
|
|
||||||
|
|
@ -209,8 +209,8 @@ class ModalMidJourneyGenerateImage:
|
||||||
return {
|
return {
|
||||||
"required": {
|
"required": {
|
||||||
"prompt": ("STRING", {"default": "一幅宏大壮美的山川画卷", "multiline": True}),
|
"prompt": ("STRING", {"default": "一幅宏大壮美的山川画卷", "multiline": True}),
|
||||||
"endpoint": ("STRING", {"default": "bowongai-test--text-video-agent-fastapi-app.modal.run"}),
|
"endpoint": ("STRING", {"default": "bowongai-dev--text-video-agent-fastapi-app.modal.run"}),
|
||||||
"timeout": ("INT", {"default": 300, "min": 10, "max": 1200}),
|
"timeout": ("INT", {"default": 120, "min": 10, "max": 600}),
|
||||||
},
|
},
|
||||||
"optional": {
|
"optional": {
|
||||||
"image": ("IMAGE",),
|
"image": ("IMAGE",),
|
||||||
|
|
@ -225,7 +225,8 @@ class ModalMidJourneyGenerateImage:
|
||||||
|
|
||||||
def process(self, prompt: str, endpoint: str, timeout: int, **kwargs):
|
def process(self, prompt: str, endpoint: str, timeout: int, **kwargs):
|
||||||
try:
|
try:
|
||||||
logger.info("请求同步接口")
|
logger.info("请求异步接口")
|
||||||
|
interval = 2
|
||||||
format = "PNG"
|
format = "PNG"
|
||||||
if "image" in kwargs and kwargs["image"] is not None:
|
if "image" in kwargs and kwargs["image"] is not None:
|
||||||
image = kwargs["image"]
|
image = kwargs["image"]
|
||||||
|
|
@ -234,25 +235,35 @@ class ModalMidJourneyGenerateImage:
|
||||||
f'image/{format.lower()}')}
|
f'image/{format.lower()}')}
|
||||||
else:
|
else:
|
||||||
files = None
|
files = None
|
||||||
job_resp = send_request("post", f"https://{endpoint}/api/union/img/sync/generate/image",
|
job_resp = send_request("post", f"https://{endpoint}/api/302/mj/async/generate/image?prompt={prompt}",
|
||||||
headers={'Authorization': 'Bearer bowong7777'},
|
headers={'Authorization': 'Bearer bowong7777'},
|
||||||
data={"prompt": prompt},
|
|
||||||
files=files,
|
files=files,
|
||||||
timeout=timeout)
|
timeout=150)
|
||||||
job_resp.raise_for_status()
|
job_resp.raise_for_status()
|
||||||
job_resp = job_resp.json()
|
job_resp = job_resp.json()
|
||||||
if not job_resp["status"]:
|
if "失败" in job_resp["msg"] or "fail" in job_resp["msg"] or "error" in job_resp["msg"]:
|
||||||
raise Exception("生成失败, 可能因为风控")
|
raise Exception("生成失败")
|
||||||
result_url = job_resp["data"]
|
job_id = job_resp["data"]
|
||||||
if isinstance(result_url, list):
|
for _ in range(0, timeout // interval, interval):
|
||||||
result_list = []
|
logger.info("查询结果")
|
||||||
for url in result_url:
|
resp = send_request("get", f"https://{endpoint}/api/302/mj/async/query/status?task_id={job_id}",
|
||||||
logger.success("img_url: " + url)
|
headers={'Authorization': 'Bearer bowong7777'}, timeout=30)
|
||||||
result_list.append(url_to_tensor(url).squeeze(0))
|
resp.raise_for_status()
|
||||||
result_list = torch.stack(result_list, dim=0)
|
if resp.json()["status"]:
|
||||||
return (result_list,)
|
if "fail" in resp.json()["msg"]:
|
||||||
logger.success("img_url: " + result_url)
|
raise Exception("生成失败,可能因为风控")
|
||||||
return (url_to_tensor(result_url),)
|
result_url = resp.json()["data"]
|
||||||
|
if isinstance(result_url, list):
|
||||||
|
result_list = []
|
||||||
|
for url in result_url:
|
||||||
|
logger.success("img_url: " + url)
|
||||||
|
result_list.append(url_to_tensor(url).squeeze(0))
|
||||||
|
result_list = torch.stack(result_list, dim=0)
|
||||||
|
return (result_list,)
|
||||||
|
logger.success("img_url: " + result_url)
|
||||||
|
return (url_to_tensor(result_url),)
|
||||||
|
sleep(interval)
|
||||||
|
raise Exception("等待超时")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
@ -263,7 +274,7 @@ class ModalMidJourneyDescribeImage:
|
||||||
return {
|
return {
|
||||||
"required": {
|
"required": {
|
||||||
"image": ("IMAGE",),
|
"image": ("IMAGE",),
|
||||||
"endpoint": ("STRING", {"default": "bowongai-test--text-video-agent-fastapi-app.modal.run"}),
|
"endpoint": ("STRING", {"default": "bowongai-dev--text-video-agent-fastapi-app.modal.run"}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -282,10 +293,10 @@ class ModalMidJourneyDescribeImage:
|
||||||
files={"img_file": (
|
files={"img_file": (
|
||||||
'image.' + format.lower(), tensor_to_image_bytes(image, format),
|
'image.' + format.lower(), tensor_to_image_bytes(image, format),
|
||||||
f'image/{format.lower()}')},
|
f'image/{format.lower()}')},
|
||||||
timeout=300)
|
timeout=150)
|
||||||
job_resp.raise_for_status()
|
job_resp.raise_for_status()
|
||||||
job_resp = job_resp.json()
|
job_resp = job_resp.json()
|
||||||
if not job_resp["status"]:
|
if "失败" in job_resp["msg"] or "fail" in job_resp["msg"] or "error" in job_resp["msg"]:
|
||||||
raise Exception("描述失败")
|
raise Exception("描述失败")
|
||||||
result = job_resp["data"]
|
result = job_resp["data"]
|
||||||
return (result,)
|
return (result,)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue