Google Colab 部署 🚀
免费,便捷,省心,适合设备性能有限的用户,强烈推荐~
想尝试本地部署?跳到 《本地安装》 章节
什么是 Colab?
借助 Colaboratory(简称 Colab),您可在浏览器中编写和执行 Python 代码,并且:
- 无需任何配置
- 免费使用 GPU
- 轻松共享
无论您是一名学生、数据科学家还是 AI 研究员,Colab 都能够帮助您更轻松地完成工作。您可以观看 Introduction to Colab(Colab 简介)或 Colab Features You May Have Missed(您可能错过的 Colab 功能)了解详情,或在下面开始使用!
WARNING
注意:需要科学上网
安装步骤
1. 克隆下载
bash
# 默认目录
%cd /content
# 删除文件
%rm -rf /content/CreatorBox/
# 克隆下载
!git clone https://github.com/xiesx123/CreatorBox.git
# 安装依赖
!pip install --use-deprecated=legacy-resolver -r /content/CreatorBox/src/support/third_party/cosyvoice/requirements.txt
!pip install --use-deprecated=legacy-resolver -r /content/CreatorBox/requirements.txt
# 安装软件
!pip install pyngrok
!curl -sSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc \
| sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null \
&& echo "deb https://ngrok-agent.s3.amazonaws.com buster main" \
| sudo tee /etc/apt/sources.list.d/ngrok.list \
&& sudo apt update \
&& sudo apt install ngrok \
&& sudo apt install rubberband-cli \
&& sudo apt install jq
2.环境变量
python
import os
# google
os.environ['GOOGLE_API_KEY'] = ''
# dashscope
os.environ['DASHSCOPE_API_KEY'] = ''
# huggingface
os.environ['HUGGINGFACEHUB_API_TOKEN'] = ''
# ngrok
os.environ['NGROK_API_KEY'] = ''
os.environ['NGROK_HOSTNAME'] = ''
TIP
环境变量配置见 《准备工作》 章节
3.启动运行
bash
# 工作目录
%cd /content/CreatorBox
# 清空日志
%rm -rf logs run.out
# 关闭进程
!kill -9 $(lsof -t -i:80)
# 启动应用无透传
# !nohup python run.py start -p 80 > run.out 2>&1 &
# 启动应用并透传 `-nh 是你申请的 Host 地址`
!nohup python run.py start -p 80 -nh 'toucan-real-informally.ngrok-free.app' --ngrok > run.out 2>&1 &
4.验证启动
bash
# 是否正常启动
!curl -s http://127.0.0.1:80/app/version | jq .
bash
# 代理是否正常
!curl -s https://toucan-real-informally.ngrok-free.app/app/version | jq .
json
{
"code": 0,
"message": "success",
"data": {
"title": "CreatorBox",
"description": "🚀🎬灵活、高效、可扩展,专属视频剪辑配音工具箱,释放创作潜力",
"version": "1.0.6",
"debug": true
}
}
实时日志
bash
!tail -f /content/CreatorBox/run.out
如图所示,成功打印说明启动成功
log
_____ _ ______
/ __ \ | | | ___ \
| / \/_ __ ___ __ _| |_ ___ _ __| |_/ / _____ __
| | | '__/ _ \/ _` | __/ _ \| '__| ___ \/ _ \ \/ /
| \__/\ | | __/ (_| | || (_) | | | |_/ / (_) > <
\____/_| \___|\__,_|\__\___/|_| \____/ \___/_/\_\ v1.0.6
2025-04-08 11:34:52.458 | INFO 1496 task.py:18 - Startup Scheduler 1 Job Completed.
2025-04-08 11:34:52.458 | INFO 1496 main.py:84 - Started CreatorBox Run Debug Success (6.16 seconds)
2025-04-08 11:34:52.459 | INFO 1496 main.py:85 - http://172.18.0.1:8000
TIP
Colab 每次只能执行1个单元格,当正常启动后,可以查看实时日志
内外透传
log
待补充