Giter VIP home page Giter VIP logo

comfy-flow-api's Introduction

富强、**、文明、和谐、合规
自由、平等、公正、法治、合法
爱国、敬业、诚信、友善、合理

comfy-flow-api

这是一个ComfyUI的API聚合项目

  1. 提供了工作流的API调用;
  2. 提供了微信小程序的授权API;

配置

在 application.properties 文件中

我们需要修改如下配置

微信小程序配置

wechat.appid=小程序 appId
wechat.secret=小程序 appSecret

ComfyUI服务的Ip

comfy.ips=ComfyUI所在服务器的IP,比如`127.0.0.1`

生成的图片的存储地址

file.storage.type=disk
file.storage.disk=/Users/xiangyuanmeng/Documents/MyProjectSpace/comfy-flow-api/static/
file.storage.view=http://127.0.0.1:8189/static/

其中

  1. 类型目前只支持本地磁盘,即file.storage.type=disk;
  2. 生成的图片存储在磁盘上,通过file.storage.disk=/xxx/xxx/配置磁盘文件夹;
  3. 生成的图片可以进行访问,通过file.storage.view=进行配置;

PS:若需要使用阿里云的对象存储、Aws的S3存储、SM.MS等其他存储方式,需要扩展FileStorage.java进行实现。

在 comfyui.json 文件中

我们需要修改如下配置

[
  {
    "name": "工作流的名称,比如动漫风格转换",
    "path": "在服务器上,动漫风格转换的workflow-api.json所在的位置,比如/comfyui/workflow-api.json"
  }
]

工作流修改

工作流文件中,某些需要替换的参数需要替换,可以参考:二次元转真人_workflow_api.json

目前支持:seed、prompt、image

本地测试

使用到的组件清单

可以访问地址: http://127.0.0.1:8189/q/dev-ui/extensions

img.png

接口API清单

可以访问地址: http://127.0.0.1:8189/q/swagger-ui/

img_1.png

简单使用

可以访问地址: http://127.0.0.1:8189/drawNow.html

img_3.png

这个工作流使用到的资源如下

  1. 模型: https://civitai.com/models/217692/mexxldimsdxllcm2?modelVersionId=245340
  2. 插件1: https://github.com/SoftMeng/ComfyUI_Mexx_Styler

只是个流程测试,没有进度条。

部署(Jar包形式)

对项目进行打包

./mvnw package -Dquarkus.package.type=uber-jar

打完包的程序在target中,安装JDK17或者21后,可以使用命令行启动

java -jar target/comfy-flow-api-runner.jar

部署(Native形式)

这需要你安装GraalVM

./mvnw package -Dnative -Dquarkus.native.container-build=true

打包后可以使用下面命令启动

./target/comfy-flow-api-1.0.0-SNAPSHOT-runner

使用步骤

1. 导出ComfyUI的API格式工作流

ComfyUI导出API格式工作流.mp4

2. 放入到工程文件夹中

step2.png

3. 将工作流文件和名称的对应关系写入到comfyui.json文件中

step3.png

4. 在drawNow.html中修改为“我的工作流AAA”

step4.png

5. 修改工作流API的参数

step5.png step6.png

6. 启动工程

访问: http://localhost:8189/drawNow.html

drawNow.png

7. 开启JOB

配置文件开启JOB, 在配置文件里开启

job.png

启动JOB后可以看到日志,正在执行生图的任务

jobresult.png

8. 访问本地生成的图片

访问: http://localhost:8189/lib.html 点击搜索

lib.png

comfy-flow-api's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.