Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #31 from xingren23/dev
Browse files Browse the repository at this point in the history
v1.2.0
  • Loading branch information
xingren23 authored Dec 6, 2023
2 parents bf93f06 + 8763848 commit 2099e3e
Show file tree
Hide file tree
Showing 20 changed files with 346 additions and 233 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

22 changes: 3 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ ComfyFlowApp helps application developers make these complexities transparent to

### How Does ComfyFlowApp Work?

ComfyFlowApp currently supports two modes: **Creator mode** and **Studio mode**. Users can flexibly switch between usage modes.

- **Creator mode**: Users (also creators) can convert the ComfyUI workflow into a web application, run the application locally, or publish it to [comfyflow.app](https://comfyflow.app/) to share it with other users.
- **Studio mode**: Users need to download and install the ComfyUI web application from [comfyflow.app](https://comfyflow.app/), and finally run ComfyFlowApp locally.
ComfyFlowApp: Users (also creators) can develop a web application from the ComfyUI workflow in seconds, and share it with other users.

::: tip

Expand Down Expand Up @@ -64,30 +61,20 @@ The workflow is shown below:
```bash
# download project
git clone https://github.com/xingren23/ComfyFlowApp
# update submodule ComfyUI
cd ComfyFlowApp
git submodule update --init --recursive

# create and activate python env
# Note: pytorch does not support python 3.12 yet so make sure your python version is 3.11 or earlier.
conda create -n comfyflowapp python=3.11
conda activate comfyflowapp

# install requirements
# install comfyui, Nvidia users should install pytorch using this command:
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
pip install -r .\repositories\ComfyUI\requirements.txt
pip install -r requirements.txt

# start or run
# linux
sh bin/creator_run.sh
sh bin/studio_run.sh
sh bin/explore_run.sh
# linux
sh bin/creator_run.sh
# windows
.\bin\creator_run.bat
.\bin\studio_run.bat
.\bin\explore_run.bat
```

env var, you could modify some env var as needed
Expand All @@ -102,9 +89,6 @@ set COMFYFLOW_API_URL=https://api.comfyflow.app
:: comfyui env for developping,you could use other machine in the same LAN, default: http://localhost:8188
set COMFYUI_SERVER_ADDR=http://localhost:8188

:: inner comfyui env for running my apps, default: http://localhost:9188, you could modify port, but localhost
set INNER_COMFYUI_SERVER_ADDR=http://localhost:9188

:: webapp server address, others in the same LAN could visit your webapp, default: localhost
set STREAMLIT_SERVER_ADDRESS=192.168.1.100
```
Expand Down
27 changes: 4 additions & 23 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ComfyFlowApp

快速将你的 ComfyUI 工作流开发成一个 Web 应用,并分享给其他用户使用。
只要几秒就可以将你的ComfyUI工作流开发成一个Web应用,并分享给其他用户使用。

## ComfyFlowApp 是什么?

Expand All @@ -21,16 +21,12 @@ ComfyFlowApp 是一个 ComfyUI 的扩展工具, 可以轻松从 ComfyUI 的工
- 用户不需要懂如何搭建 ComfyUI 工作流;
- 用户不需要懂 Python 安装环境;

ComfyFlowApp 帮助应用开发者将这些复杂度对用户透明,用户只需要像普通应用一样使用即可。
**总结,ComfyFlowApp 帮助工作流开发者简化工作流的使用难度,用户只需要像普通应用一样使用即可。**

**总结,如果你需要将 ComfyUI 开发的工作流分享给其他用户使用,选择 ComfyFlowApp 就对了。**

### ComfyFlowApp 的运行方式

ComfyFlowApp 目前支持两种模式:**Creator 模式****Studio 模式**,用户可以灵活切换使用模式。

- **Creator 模式**:用户(也是创作者)可以将 ComfyUI 工作流转换为一个 Web 应用,可以在本地运行应用,也可以发布到 [comfyflow.app](https://comfyflow.app/),分享给其他用户使用。
- **Studio 模式**:用户需要从 [comfyflow.app](https://comfyflow.app/) 下载并安装 ComfyUI Web 应用,最后在本地运行 ComfyFlowApp。
ComfyFlowApp :用户(也是创作者)可以将 ComfyUI 工作流转换为一个 Web 应用,并分享给其他用户使用。

::: tip

Expand Down Expand Up @@ -71,31 +67,19 @@ ComfyFlowApp 目前支持两种模式:**Creator 模式** 和 **Studio 模式**
# 下载项目
git clone https://github.com/xingren23/ComfyFlowApp

# 更新comfyui依赖
cd ComfyFlowApp
git submodule update --init --recursive

# 使用Conda创建并管理python环境
# Note: pytorch does not support python 3.12 yet so make sure your python version is 3.11 or earlier.
conda create -n comfyflowapp python=3.11
conda activate comfyflowapp

# 安装comfyui依赖, Nvidia users should install pytorch using this command:
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
pip install -r .\repositories\ComfyUI\requirements.txt

# 安装ComfyFlowApp依赖
pip install -r requirements.txt

# 启动
# linux
sh bin/creator_run.sh
sh bin/studio_run.sh
sh bin/explore_run.sh
# windows
.\bin\creator_run.bat
.\bin\studio_run.bat
.\bin\explore_run.bat

```

环境变量, 在启动脚本中可以修改相关变量
Expand All @@ -107,9 +91,6 @@ set COMFYFLOW_API_URL=https://api.comfyflow.app
:: 开发联调外部ComfyUI地址,可以连接局域网内其他服务器地址,默认:http://localhost:8188
set COMFYUI_SERVER_ADDR=http://localhost:8188
:: ComfyFlowApp内置ComfyUI地址,只能使用本机地址,默认:http://localhost:9188
set INNER_COMFYUI_SERVER_ADDR=http://localhost:9188
:: 设置web应用启动地址,让局域网内其他用户可以访问你的应用,默认:localhost
set STREAMLIT_SERVER_ADDRESS=192.168.1.100
```
Expand Down
3 changes: 1 addition & 2 deletions bin/creator_run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ cd /d %PROJECT_DIR%

:: set LOGURU_LEVEL to INFO
set LOGURU_LEVEL=INFO

set STREAMLIT_SERVER_PORT=8501
:: set COMFYFLOW_API_URL to https://api.comfyflow.app
set COMFYFLOW_API_URL=https://api.comfyflow.app
:: set COMFYUI_SERVER_ADDR to localhost:8188
set COMFYUI_SERVER_ADDR=http://localhost:8188
:: set INNER_COMFYUI_SERVER_ADDR to localhost:9188
set INNER_COMFYUI_SERVER_ADDR=http://localhost:9188
:: set discord callback url
set DISCORD_REDIRECT_URI=http://localhost:8501
:: set MODE
Expand Down
7 changes: 2 additions & 5 deletions bin/creator_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,16 @@ cd $PROJECT_PATH

# set LOGURU_LEVEL to ERROR
export LOGURU_LEVEL=INFO

export STREAMLIT_SERVER_PORT=8501
# set COMFYFLOW_API_URL to comfyflow api url
export COMFYFLOW_API_URL=https://api.comfyflow.app
# set COMFYUI_SERVER_ADDR to comfyui server addr
export COMFYUI_SERVER_ADDR=http://localhost:8188
# set INNER_COMFYUI_SERVER_ADDR to inner comfyui server addr
export INNER_COMFYUI_SERVER_ADDR=http://localhost:9188
# set discord callback url
export DISCORD_REDIRECT_URI=http://localhost:8501
# set MODE to Creator
export MODE=Creator

# app name
APP_NAME="Home"
# script params
python -m streamlit run "$APP_NAME.py"
python -m streamlit run Home.py
5 changes: 1 addition & 4 deletions bin/explore_run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ set LOGURU_LEVEL=INFO
set STREAMLIT_SERVER_PORT=8503
:: set COMFYFLOW_API_URL to https://api.comfyflow.app
set COMFYFLOW_API_URL=https://api.comfyflow.app
:: set COMFYUI_SERVER_ADDR to localhost:8288
set COMFYUI_SERVER_ADDR=http://localhost:8288
:: set INNER_COMFYUI_SERVER_ADDR to localhost:9288
set INNER_COMFYUI_SERVER_ADDR=http://localhost:9288

:: set discord callback url
set DISCORD_REDIRECT_URI=http://localhost:8503
:: set MODE
Expand Down
10 changes: 3 additions & 7 deletions bin/explore_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@ cd $PROJECT_PATH

# set LOGURU_LEVEL to ERROR
export LOGURU_LEVEL=INFO

export STREAMLIT_SERVER_PORT=8503
# set COMFYFLOW_API_URL to comfyflow api url
export COMFYFLOW_API_URL=https://api.comfyflow.app
# set COMFYUI_SERVER_ADDR to comfyui server addr
export COMFYUI_SERVER_ADDR=http://localhost:8188
# set INNER_COMFYUI_SERVER_ADDR to inner comfyui server addr
export INNER_COMFYUI_SERVER_ADDR=http://localhost:9188

# set discord callback url
export DISCORD_REDIRECT_URI=http://localhost:8503
# set MODE to Studio
export MODE=Explore

# app name
APP_NAME="Home"
# script params
python -m streamlit run "$APP_NAME.py"
python -m streamlit run Home.py
26 changes: 0 additions & 26 deletions bin/studio_run.bat

This file was deleted.

26 changes: 0 additions & 26 deletions bin/studio_run.sh

This file was deleted.

Binary file modified docs/images/how-it-works.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions modules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ def get_inner_comfy_client():
comfy_client = ComfyClient(server_addr=server_addr)
return comfy_client

def check_inner_comfyui_alive():
try:
get_inner_comfy_client().queue_remaining()
return True
except Exception as e:
logger.warning(f"check comfyui alive error, {e}")
return False

def check_comfyui_alive():
try:
get_comfy_client().queue_remaining()
return True
except Exception as e:
logger.warning(f"check comfyui alive error, {e}")
return False

@st.cache_data(ttl=60)
def get_comfyui_object_info():
Expand Down
11 changes: 2 additions & 9 deletions modules/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
import streamlit as st
import subprocess
from threading import Thread
from modules import get_inner_comfy_client
from modules import check_inner_comfyui_alive
from streamlit.runtime.scriptrunner import add_script_run_ctx


def prepare_comfyui_path():
comfyui_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'repositories', 'ComfyUI'))
if comfyui_path not in sys.path:
logger.info(f"add comfyui path {comfyui_path}")
sys.path.insert(0, comfyui_path)
return comfyui_path


class ComfyUIThread(Thread):
def __init__(self, server_addr, path):
Thread.__init__(self)
Expand Down Expand Up @@ -43,13 +43,6 @@ def run(self):
except Exception as e:
logger.error(f"running comfyui error, {e}")

def check_inner_comfyui_alive():
try:
get_inner_comfy_client().queue_remaining()
return True
except Exception as e:
logger.warning(f"check comfyui alive error, {e}")
return False

def start_comfyui():
try:
Expand Down
Loading

0 comments on commit 2099e3e

Please sign in to comment.