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

Commit

Permalink
fix: use get image (when comfyui api not available for user)
Browse files Browse the repository at this point in the history
add daemon/stop script for linux
  • Loading branch information
xingren23 committed Dec 20, 2023
1 parent 3f36e30 commit 9ac58ed
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
23 changes: 23 additions & 0 deletions bin/creator_daemon.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# get current path
CUR_DIR="$(cd "$(dirname "$0")" && pwd)/$(basename "$0")"
PROJECT_PATH=$(dirname $(dirname "$CUR_DIR"))
echo "$PROJECT_PATH"
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 discord callback url
export DISCORD_REDIRECT_URI=http://localhost:8501
# set MODE to Creator
export MODE=Creator

# script params
nohup python -m streamlit run Home.py > app.log 2>&1 &
14 changes: 14 additions & 0 deletions bin/creator_stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# 停止脚本
APP_NAME="streamlit"

# 查找并终止正在运行的 Flask 应用程序进程
PID=$(ps aux | grep "$APP_NAME" | grep -v grep | awk '{print $2}')
if [ -n "$PID" ]; then
echo "Stopping $APP_NAME $PID..."
kill $PID
echo "Stoped $APP_NAME"
else
echo "$APP_NAME is not running."
fi
6 changes: 4 additions & 2 deletions modules/comfyflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ def get_outputs(self):
if 'images' in node_output:
images_output = []
for image in node_output['images']:
image_url = self.comfy_client.get_image_url(image['filename'], image['subfolder'], image['type'])
images_output.append(image_url)
# image_url = self.comfy_client.get_image_url(image['filename'], image['subfolder'], image['type'])
# images_output.append(image_url)
image_data = self.comfy_client.get_image(image['filename'], image['subfolder'], image['type'])
images_output.append(image_data)

logger.info(f"Got images from server, {node_id}, {len(images_output)}")
return 'images', images_output
Expand Down

0 comments on commit 9ac58ed

Please sign in to comment.