当前位置: 首页 > wzjs >正文

顺德网站建设域名wordpress 主题 不一样

顺德网站建设域名,wordpress 主题 不一样,黑科技引流工具,wordpress中国风主题可以参考【生成模型】【ComfyUI(一)】Flux与Flux-Fill部署与API调用中Flux-Fill部分 1. 调整Workflow 我们要部署以下workflow 做两个修改 输入改为从Load Image(Base64) 读入图片,当然使用上面的从路径中读图也是可以的输出改为SaveImag…

可以参考【生成模型】【ComfyUI(一)】Flux与Flux-Fill部署与API调用中Flux-Fill部分

1. 调整Workflow

我们要部署以下workflow
在这里插入图片描述
做两个修改

  • 输入改为从Load Image(Base64) 读入图片,当然使用上面的从路径中读图也是可以的
  • 输出改为SaveImageWebsocket节点,通过websocket返回图片,当然使用SaveImage给定路径也是可以的
    ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/d2e2f42f33df4567a63750900590cb75.png

2. 导出API调用json文件

3. 使用接口调用

import requests, websocket
import base64, io
from PIL import Image, ImageColordef buffer2img(imagebuf, mode='RGB', input_type='base64'):if input_type == 'base64':buf = base64.b64decode(imagebuf)elif input_type == 'bytes':buf = imagebufelse:raise ValueError(f"input_type should in ['base64', 'bytes'], but got {input_type}")pil_img = Image.open(io.BytesIO(buf)).convert(mode)return pil_imgdef get_server_address():server_address = "127.0.0.1:8081"return server_addressclass ComfyUIRequest:def __init__(self):passdef queue_prompt(self, prompt, client_id, server_address):"""将任务提交给server_address上的ComfyUI,进入处理队列,同时获得返回的trace_id"""p = {"prompt": prompt, "client_id": client_id}# data = json.dumps(p).encode('utf-8')# req =  urllib.request.Request("http://{}/prompt".format(server_address), data=data)# json.loads(urllib.request.urlopen(req).read())response = requests.post(f"http://{server_address}/prompt", json=p)if response.status_code == 200:return response.json()else:print(f"{response}, {response.text}")return Nonedef get_images_from_web_socket(self, prompt, prompt_id, client_id, server_address):ws = websocket.WebSocket()ws.connect("ws://{}/ws?clientId={}".format(server_address, client_id))output_images = {}current_node = ""while True:out = ws.recv()print(out, type(out))# {"type": "progress", "data": {"value": 0, "max": 1, "prompt_id": "b2f90b54-b022-4993-8042-389455b04134", "node": "50"}} <class 'str'>if isinstance(out, str):message = json.loads(out)# if message['type'] == 'executing':  # progressif message['type'] in ['executing', 'progress']:  # progressdata = message['data']if 'prompt_id' in data and data['prompt_id'] == prompt_id:if data['node'] is None:break #Execution is doneelse:current_node = data['node']else:if prompt[current_node]["class_type"] == "SaveImageWebsocket":images_output = output_images.get(current_node, [])images_output.append(out[8:])output_images[current_node] = images_outputreturn output_imagesdef __call__(self, prompt, client_id, server_address=None):if server_address is None:server_address = get_server_address()req_data = self.queue_prompt(prompt, client_id, server_address)  # 发起请求,任务启动就会返回print(f"req to {req_data}")prompt_id = req_data['prompt_id']out_images = self.get_images_from_web_socket(prompt, prompt_id, client_id, server_address)  # 阻塞式接受返回return out_imagescomfyui_reqest = ComfyUIRequest()import jsondefalut_params = json.load(open("05_flux_fill_outpaint_fp8_3.json"))
defalut_params["17"]["inputs"]["image"] = os.path.abspath("524169.jpg")    # input image has mul masked
defalut_params["47"]["inputs"]["image"] = os.path.abspath("524169_mask.jpg")  # mask imageouts = comfyui_reqest(defalut_params, client_id="12347")
result_img = buffer2img(outs['50'][0], input_type='bytes')

print(f"req to {req_data}")打印如下:

req to {'prompt_id': '024d4de7-258b-461c-95fa-a0de3f2fefb0', 'number': 45, 'node_errors': {}}

print(out, type(out))打印如下

{"type": "status", "data": {"status": {"exec_info": {"queue_remaining": 1}}, "sid": "16745628-e6ae-46a9-99a3-fa3a5d53f586"}} <class 'str'>
{"type": "execution_cached", "data": {"nodes": ["7", "23", "26", "31", "32", "34", "38", "39", "55", "56", "57", "58"], "prompt_id": "eb77c8c4-40d5-4dc0-a6a9-234c25cb4722", "timestamp": 1740473304127}} <class 'str'>
{"type": "executed", "data": {"node": "58", "display_node": "58", "output": {"images": [{"filename": "ComfyUI_00022_.png", "subfolder": "", "type": "output"}]}, "prompt_id": "eb77c8c4-40d5-4dc0-a6a9-234c25cb4722"}} <class 'str'>
{"type": "executed", "data": {"node": "57", "display_node": "57", "output": {"images": [{"filename": "ComfyUI_temp_ukmnl_00001_.png", "subfolder": "", "type": "temp"}]}, "prompt_id": "eb77c8c4-40d5-4dc0-a6a9-234c25cb4722"}} <class 'str'>
{"type": "executing", "data": {"node": "52", "display_node": "52", "prompt_id": "eb77c8c4-40d5-4dc0-a6a9-234c25cb4722"}} <class 'str'>
{"type": "progress", "data": {"value": 1, "max": 20, "prompt_id": "eb77c8c4-40d5-4dc0-a6a9-234c25cb4722", "node": "52"}} <class 'str'>
{"type": "progress", "data": {"value": 2, "max": 20, "prompt_id": "eb77c8c4-40d5-4dc0-a6a9-234c25cb4722", "node": "52"}} <class 'str'>
{"type": "progress", "data": {"value": 3, "max": 20, "prompt_id": "eb77c8c4-40d5-4dc0-a6a9-234c25cb4722", "node": "52"}} <class 'str'>
......
{"type": "progress", "data": {"value": 19, "max": 20, "prompt_id": "eb77c8c4-40d5-4dc0-a6a9-234c25cb4722", "node": "52"}} <class 'str'>
{"type": "progress", "data": {"value": 20, "max": 20, "prompt_id": "eb77c8c4-40d5-4dc0-a6a9-234c25cb4722", "node": "52"}} <class 'str'>
{"type": "executing", "data": {"node": "8", "display_node": "8", "prompt_id": "eb77c8c4-40d5-4dc0-a6a9-234c25cb4722"}} <class 'str'>
{"type": "executing", "data": {"node": "50", "display_node": "50", "prompt_id": "eb77c8c4-40d5-4dc0-a6a9-234c25cb4722"}} <class 'str'>
{"type": "progress", "data": {"value": 0, "max": 1, "prompt_id": "eb77c8c4-40d5-4dc0-a6a9-234c25cb4722", "node": "50"}} <class 'str'>
http://www.dtcms.com/wzjs/561730.html

相关文章:

  • 广州建设集团网站网络ui设计培训班
  • 响应式网站开发流程网站建设学习哪家专业
  • 成都建设厅官方网站app拉新任务平台
  • 申请域名建立网站招工最新招聘信息
  • 网站关键字没有排名photoshop官方下载
  • 湖南网站建设oqiandu最新源码论坛
  • asp.net mvc 5 网站开发之美 pdfseo的收费标准
  • 如何直接用jsp做网站不写servlet优化培训内容
  • 网站如何做流量成品ppt网站国外
  • 珠海建设工程监督站网站个人备案网站名称
  • 杭州网站建设zj net定制网络接口报警灯生产厂商
  • 网站模板大全下载温州网络学堂
  • 成都网站建设低价台州网站建设方案
  • 网站做彩票犯法吗引流量的网站
  • 网站首页设计原则七牛怎么做网站服务器
  • 佛山做网站格阿里巴巴对外做网站吗
  • 自己做网站还有出路吗如何用cms做网站
  • 南京网站建设哪家专业大学网站栏目建设通知
  • 2W网站建设的作用开发网站用什么语言
  • 盛世阳光-网站建设济南seo网站优化
  • 做网站需要哪些知识夹娃娃网站如何做
  • 手机怎么做黑网站吗成年s8视频加密线路
  • asp网站开发 基础随州网站建设哪家好
  • 盟族网站建设网站开发html书籍下载
  • 安徽省水利建设厅官方网站那些网站使用vue做的
  • 网站做cpa赚钱吗虚拟主机空间 配置 网站
  • 精神文明建设网站专栏济南建设局
  • 做网站卖SEO网站公司
  • 宝塔面板做网站绑定域名免费域名注册网中国万网
  • 服务器搭建网站视频教程向国旗致敬做时代新人网站