Skip to content

Commit e07aa64

Browse files
committed
add landing page and huggingface space demo
1 parent 54995f3 commit e07aa64

5 files changed

Lines changed: 1209 additions & 17 deletions

File tree

.github/workflows/deploy-to-hf.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Deploy to Hugging Face Space
2+
3+
on:
4+
push:
5+
branches: ["master"]
6+
workflow_dispatch: # 允许手动触发
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.13'
22+
23+
- name: Install uv
24+
run: |
25+
curl -LsSf https://astral.sh/uv/install.sh | sh
26+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
27+
28+
- name: Export requirements.txt
29+
run: |
30+
uv export --no-hashes --no-dev -o requirements.txt
31+
32+
- name: Prepare deployment files
33+
run: |
34+
# 创建临时部署目录
35+
mkdir -p /tmp/hf-deploy
36+
37+
# 复制必要文件到部署目录
38+
cp examples/app.py /tmp/hf-deploy/app.py
39+
cp requirements.txt /tmp/hf-deploy/
40+
cp -r src /tmp/hf-deploy/
41+
42+
cp README.md /tmp/hf-deploy/ || echo "README.md not found, skipping"
43+
44+
cp LICENSE /tmp/hf-deploy/ || echo "LICENSE not found, skipping"
45+
46+
# 创建 .gitignore for HF Space
47+
cat > /tmp/hf-deploy/.gitignore << 'EOF'
48+
__pycache__/
49+
*.py[cod]
50+
.venv/
51+
*.mov
52+
*.mp4
53+
outputs/
54+
inputs/
55+
EOF
56+
57+
- name: Push to Hugging Face Space
58+
env:
59+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
60+
HF_USERNAME: bbruceyuan
61+
HF_SPACE_NAME: auto-chapter-bar
62+
run: |
63+
cd /tmp/hf-deploy
64+
65+
# 配置 git
66+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
67+
git config --global user.name "github-actions[bot]"
68+
69+
# 初始化 git 仓库
70+
git init
71+
git checkout -b main
72+
73+
# 添加所有文件
74+
git add .
75+
git commit -m "Deploy from GitHub Actions - $(date +'%Y-%m-%d %H:%M:%S')"
76+
77+
# 推送到 Hugging Face
78+
git remote add hf https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE_NAME}
79+
git push -f hf main

Makefile

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: format check test install clean help
1+
.PHONY: format check test install clean help test-deploy export-requirements
22

33
format:
44
uv run ruff format .
@@ -19,11 +19,21 @@ clean:
1919
find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true
2020
find . -type f -name "*.pyc" -delete
2121

22+
export-requirements:
23+
uv export --no-hashes --no-dev -o requirements.txt
24+
@echo "✅ requirements.txt exported"
25+
26+
test-deploy:
27+
@echo "🧪 Testing Hugging Face deployment configuration..."
28+
@./.github/test-deployment.sh
29+
2230
help:
2331
@echo "Available commands:"
24-
@echo " make format - Format code with ruff"
25-
@echo " make check - Run linting"
26-
@echo " make test - Run tests"
27-
@echo " make install - Install in dev mode"
28-
@echo " make clean - Clean cache files"
29-
@echo " make help - Show this help message"
32+
@echo " make format - Format code with ruff"
33+
@echo " make check - Run linting"
34+
@echo " make test - Run tests"
35+
@echo " make install - Install in dev mode"
36+
@echo " make clean - Clean cache files"
37+
@echo " make export-requirements - Export requirements.txt for deployment"
38+
@echo " make test-deploy - Test Hugging Face deployment setup"
39+
@echo " make help - Show this help message"

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# 🎬 Auto Chapter Bar
22

3+
[![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-blue)](https://huggingface.co/spaces/bbruceyuan/auto-chapter-bar)
4+
[![Python 3.13+](https://img.shields.io/badge/python-3.13+-blue.svg)](https://www.python.org/downloads/)
5+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
6+
[![GitHub stars](https://img.shields.io/github/stars/bbruceyuan/auto-chapter-bar?style=social)](https://github.com/bbruceyuan/auto-chapter-bar/stargazers)
7+
38
Auto Chapter Bar(简称 `acb`)是一个开源的 Python 工具,可以快速将 SRT 字幕文件转换为带有 Alpha 透明通道的视频章节进度条。它特别适用于提升长视频的观看体验和完播率。
49

510
**直接在终端使用:** `acb input.srt 360``chapterbar input.srt 360`

examples/app.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,17 @@ def create_interface():
240240

241241
gr.Markdown(
242242
"""
243-
# 🎬 Auto-Chapter-Bar v2
243+
# 🎬 [Auto-Chapter-Bar](https://github.com/bbruceyuan/auto-chapter-bar)
244244
### 将 SRT 字幕文件转换为可叠加的视频章节进度条动画
245245
246246
**使用说明**:上传 SRT 文件 → 设置参数 → 点击生成 → 下载透明视频
247247
248248
**特性**:
249-
• AI 智能分段(需要 Moonshot API Key)
250-
• 固定间隔分段(免费)
251-
• 透明通道输出(直接叠加到原视频)
252-
• 支持中文字幕
249+
250+
* AI 智能分段(需要 Moonshot API Key)
251+
* 固定间隔分段(免费)
252+
* 透明通道输出(直接叠加到原视频)
253+
* 支持中文字幕
253254
"""
254255
)
255256

@@ -353,12 +354,10 @@ def create_interface():
353354
3. 将章节条拖到最上层轨道
354355
4. 导出最终视频
355356
356-
**查看使用教程**: [docs/USAGE.md](docs/USAGE.md)
357-
358-
**GitHub 仓库**: [https://github.com/yourusername/auto-chapter-bar](https://github.com/yourusername/auto-chapter-bar)
357+
**GitHub 仓库**: [https://github.com/bbruceyuan/auto-chapter-bar](https://github.com/bbruceyuan/auto-chapter-bar)
359358
360359
---
361-
Made with ❤️ by Auto-Chapter-Bar Team
360+
Made with ❤️ by [Chaofa Yuan](https://yuanchaofa.com)
362361
"""
363362
)
364363

@@ -403,4 +402,4 @@ def generate_and_display(df, dur, w, h):
403402

404403
if __name__ == "__main__":
405404
app = create_interface()
406-
app.launch(server_name="0.0.0.0", server_port=7860, share=False, debug=True)
405+
app.launch()

0 commit comments

Comments
 (0)