Home

Awesome

<p align='center'> 古人云:道生一,一生二,二生StableDiffuion,StableDiffusion生万物 <a href='https://www.connectai-e.com' target="_blank" rel="noopener noreferrer"> <img width="1000" alt="image" src="https://github-production-user-asset-6210df.s3.amazonaws.com/16874002/238823929-9c9233e5-6a3e-42e4-b562-760af22143ec.png"> </a> <details align='center'> <summary> 📷 点击展开完整功能截图 </summary> <br> <p align='center'> <h1>Txt2Img:文生图</h1> <img width="1000" alt="image" src="https://github.com/ConnectAI-E/Feishu-Stablediffusion/assets/16874002/af5e0beb-dbf7-4f5a-b34c-1d9b0b6976cd"> <img width="1000" alt="image" src="https://github.com/ConnectAI-E/Feishu-Stablediffusion/assets/16874002/374c8f91-3662-4aaf-8f57-c8decb8771ce"> <h1>Img2Txt:图生文</h1> <img width="1000" alt="image" src="https://github.com/ConnectAI-E/Feishu-Stablediffusion/assets/16874002/88922eb8-89f5-40e8-ab7f-42317296ba29"> <h1>Img2Img:图生图</h1> <img width="1000" alt="image" src="https://github.com/ConnectAI-E/Feishu-Stablediffusion/assets/16874002/d837171c-c872-425b-9625-4e3fef11c1e7"> </p> </details>
</p> <p align='center'> 🎭 由stablediffusion赋能的飞书图片生成类机器人 <br> <br> 🚀 Feishu SD 🚀 </p>

功能点


部署 Stable Diffusion WebUI

项目使用Stable Diffusion WebUI作为后端(带 --api参数启动),飞书作为前端,通过机器人,不再需要打开网页,在飞书里就可以使用StableDiffusion进行各种创作!

<details align='left'> <summary> 📷 点击查看详细步骤 </summary> <br>

更新 python 版本

使用 pyenv 安装 Python 3.10.6

按以下命令依次执行

git clone https://github.com/pyenv/pyenv.git ~/.pyenv
cd ~/.pyenv && src/configure && make -C src
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
echo 'eval "$(pyenv init -)"' >> ~/.profile
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
sudo apt install wget lzma liblzma-dev build-essential libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev 
pyenv install 3.10.6
pyenv global 3.10.6

切换国内 Linux 安装镜像

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo vim/etc/apt/sources.list

# 修改为下列源内容
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
# 源结束结束


sudo apt-get update
sudo apt-get upgrade

安装 Nvidia 驱动

sudo apt update
sudo apt upgrade
sudo apt install nvidia-driver-530 nvidia-dkms-530
sudo reboot

等待重启,重新登录服务器,测试安装驱动成功

nvidia-smi

安装stable-diffusion-webui 并启动服务

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git ~/stable-diffusion-webui
cd ~/stable-diffusion-webui && bash webui.sh --api --listen
## 等待安装完成,运行成功后,Ctrl+C停止进程,然后运行下面命令后台运行 stable-diffusion-webui
cd ~/stable-diffusion-webui && nohup bash webui.sh --api --listen &
</details>

部署飞书机器人

  1. config-example.yml复制为config.yml
  2. 编辑config.yml,添加机器人以及 StableDiffusionWebUI 的服务器信息;
  3. (可选)创建 Python 虚拟环境 python3 -m venv .venv && source .venv/bin/activate
  4. 安装依赖库 pip install -r requirements.txt,然后运行 python3 src/main.py
  5. 其他飞书配置步骤,参考 飞书-OpenAI 部署指南

操作方式

操作命令

命令功能
/help显示帮助
/list_models显示可用的模型
/list_sampler显示可用的采样器
/list_upscalers显示可用的放大器
/host_info显示最大内存,可用内存,最大显存,可用显存
/quene查询当前生成队列里的任务情况
/model显示当前模型
命令参数功能
/modelstr设置 StableDiffuion 模型

设置关键词:

参数类型功能默认值
--samplerstr设置采样器"Euler a"
--stepsint设置采样步数20
--widthint设置宽度512
--heightint设置高度512
--batch_sizeint设置批次大小1
--batch_countint设置批次数量1
--seedint设置种子-1
--cfg_scalefloat设置提示词的控制度7.0
--restore_facesbool设置是否修复面容False
--enable_hrbool设置是否高清修复False
--hr_upscalerstr设置放大器Latent
--hr_scaleflat设置放大倍率2
--denoising_strengthfloat设置重绘强度0.7
--resize_modeint设置缩放模式0

探索企联AI

<div style="width:200px">AI</div><img width=120> SDK <img width=120>Application
🎒OpenAIGo-OpenAI🏅Feishu-OpenAI, 🎖Lark-OpenAI, Feishu-EX-ChatGPT, 🎖Feishu-OpenAI-Stream-Chatbot, Feishu-TLDR,Feishu-OpenAI-Amazing, Feishu-Oral-Friend, Feishu-OpenAI-Base-Helper, Feishu-Vector-Knowledge-Management, Feishu-OpenAI-PDF-Helper, 🏅Dingtalk-OpenAI, Wework-OpenAI, WeWork-OpenAI-Node, llmplugin
🤖 AutoGPT------🏅AutoGPT-Next-Web
🎭 Stablediffusion------🎖Feishu-Stablediffusion
🍎 MidjourneyGo-Midjourney🏅Feishu-Midjourney, 🔥MidJourney-Web, Dingtalk-Midjourney
🍍 文心一言Go-WenxinFeishu-Wenxin, Dingtalk-Wenxin, Wework-Wenxin
💸 MinimaxGo-MinimaxFeishu-Minimax, Dingtalk-Minimax, Wework-Minimax
⛳️ CLAUDEGo-ClaudeFeishu-Claude, DingTalk-Claude, Wework-Claude
🥁 PaLMGo-PaLMFeishu-PaLM,DingTalk-PaLM,Wework-PaLM
🎡 Prompt------📖 Prompt-Engineering-Tutior
🍋 ChatGLM------Feishu-ChatGLM
⛓ LangChain------📖 LangChain-Tutior
🪄 One-click------🎖Awesome-One-Click-Deployment