部署步骤
部署到 Hugging Face Spaces
方式一:通过 Web 界面部署
-
创建 Space: 访问 https://huggingface.co/new-space
- 选择 "Docker" SDK
- 设置 Space 名称
- 选择硬件配置(免费版即可开始)
-
克隆 Space 仓库:
git clone https://huggingface.co/spaces/tianzijian/HermesFace
cd YOUR_SPACE_NAME
提交更新:
git add .
git commit -m "Initial deployment"
- 复制项目文件:
# 复制所有项目文件到 Space 目录
cp -r /path/to/hermes-spaces/* .
-
配置环境变量:
- 在 Space Settings → Variables 中设置:
HF_DATASET_REPO:your-username/hermes-dataHF_TOKEN:your-huggingface-token
- 在 Space Settings → Variables 中设置:
-
提交并推送:
hf auth login
hf upload tianzijian/HermesFace . --repo-type space --commit-message "Initial upload"
- 等待部署完成:
- 访问
https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME - 查看 Build 日志,等待部署完成
- 访问
方式二:通过 GitHub Actions 自动部署
-
Fork 本仓库 到你的 GitHub 账号
-
在 Hugging Face 创建 Space:
- 访问 https://huggingface.co/new-space
- 选择 Docker SDK
- 记下 Space 名称
-
配置 GitHub Secrets:
- 进入 GitHub 仓库 → Settings → Secrets and variables → Actions
- 添加以下 secrets:
HF_TOKEN: 你的 Hugging Face access tokenHF_SPACE_REPO:YOUR_USERNAME/YOUR_SPACE_NAME
-
推送代码到 main 分支:
git push origin main
- GitHub Actions 会自动部署:
- 查看 Actions 标签页查看部署进度
- 部署完成后访问 Space URL
暂无评论