mirror of
https://github.com/linyqh/NarratoAI.git
synced 2026-07-23 06:28:25 +00:00
Add uv-based dependency management
This commit is contained in:
parent
23591defb1
commit
fd43bf7c0b
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,6 +1,8 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
/config.toml
|
/config.toml
|
||||||
/storage/
|
/storage/
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
/.idea/
|
/.idea/
|
||||||
/app/services/__pycache__
|
/app/services/__pycache__
|
||||||
/app/__pycache__/
|
/app/__pycache__/
|
||||||
@ -53,4 +55,4 @@ tests/*
|
|||||||
!tests/test_generate_script_docu_unittest.py
|
!tests/test_generate_script_docu_unittest.py
|
||||||
|
|
||||||
docs/reddit-community
|
docs/reddit-community
|
||||||
docs/wechat-0.8
|
docs/wechat-0.8
|
||||||
|
|||||||
1
.python-version
Normal file
1
.python-version
Normal file
@ -0,0 +1 @@
|
|||||||
|
3.12
|
||||||
20
Dockerfile
20
Dockerfile
@ -15,16 +15,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
pkg-config \
|
pkg-config \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# 升级 pip 并创建虚拟环境
|
# 安装 uv 并创建构建虚拟环境
|
||||||
RUN python -m pip install --upgrade pip setuptools wheel && \
|
RUN python -m pip install --upgrade pip setuptools wheel uv
|
||||||
python -m venv /opt/venv
|
|
||||||
|
|
||||||
# 激活虚拟环境
|
# 让 uv 将项目依赖同步到运行阶段复用的虚拟环境
|
||||||
ENV PATH="/opt/venv/bin:$PATH"
|
ENV UV_PROJECT_ENVIRONMENT="/opt/venv" \
|
||||||
|
UV_LINK_MODE=copy \
|
||||||
|
UV_COMPILE_BYTECODE=1 \
|
||||||
|
PATH="/opt/venv/bin:$PATH"
|
||||||
|
|
||||||
# 复制 requirements.txt 并使用镜像安装 Python 依赖
|
# 复制 uv 项目文件并安装 Python 依赖
|
||||||
COPY requirements.txt .
|
COPY pyproject.toml uv.lock ./
|
||||||
RUN pip install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
|
RUN uv sync --frozen --no-dev
|
||||||
|
|
||||||
# 运行阶段
|
# 运行阶段
|
||||||
FROM python:3.12-slim-bookworm
|
FROM python:3.12-slim-bookworm
|
||||||
@ -86,4 +88,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
|||||||
|
|
||||||
# 设置入口点
|
# 设置入口点
|
||||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||||
CMD ["webui"]
|
CMD ["webui"]
|
||||||
|
|||||||
11
README-en.md
11
README-en.md
@ -91,6 +91,17 @@ Below is a screenshot of this person's x (Twitter) homepage
|
|||||||
- Windows 10/11 or MacOS 11.0 or above
|
- Windows 10/11 or MacOS 11.0 or above
|
||||||
- [Python 3.12+](https://www.python.org/downloads/)
|
- [Python 3.12+](https://www.python.org/downloads/)
|
||||||
|
|
||||||
|
## Local Run 🚀
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/linyqh/NarratoAI.git
|
||||||
|
cd NarratoAI
|
||||||
|
|
||||||
|
uv sync
|
||||||
|
cp config.example.toml config.toml
|
||||||
|
uv run streamlit run webui.py --server.maxUploadSize=2048
|
||||||
|
```
|
||||||
|
|
||||||
## Feedback & Suggestions 📢
|
## Feedback & Suggestions 📢
|
||||||
|
|
||||||
👏 1. You can submit [issue](https://github.com/linyqh/NarratoAI/issues) or [pull request](https://github.com/linyqh/NarratoAI/pulls)
|
👏 1. You can submit [issue](https://github.com/linyqh/NarratoAI/issues) or [pull request](https://github.com/linyqh/NarratoAI/pulls)
|
||||||
|
|||||||
@ -129,8 +129,8 @@ docker compose up -d
|
|||||||
git clone https://github.com/linyqh/NarratoAI.git
|
git clone https://github.com/linyqh/NarratoAI.git
|
||||||
cd NarratoAI
|
cd NarratoAI
|
||||||
|
|
||||||
# 2. 安装依赖
|
# 2. 使用 uv 安装依赖
|
||||||
pip install -r requirements.txt
|
uv sync
|
||||||
|
|
||||||
# 3. 复制配置文件
|
# 3. 复制配置文件
|
||||||
cp config.example.toml config.toml
|
cp config.example.toml config.toml
|
||||||
@ -138,7 +138,7 @@ cp config.example.toml config.toml
|
|||||||
# 4. 编辑 config.toml,配置你的 API 密钥
|
# 4. 编辑 config.toml,配置你的 API 密钥
|
||||||
|
|
||||||
# 5. 启动应用
|
# 5. 启动应用
|
||||||
streamlit run webui.py --server.maxUploadSize=2048
|
uv run streamlit run webui.py --server.maxUploadSize=2048
|
||||||
|
|
||||||
# 6. 访问应用
|
# 6. 访问应用
|
||||||
# 浏览器打开 http://localhost:8501
|
# 浏览器打开 http://localhost:8501
|
||||||
|
|||||||
50
pyproject.toml
Normal file
50
pyproject.toml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
[project]
|
||||||
|
name = "narratoai"
|
||||||
|
version = "0.8.4"
|
||||||
|
description = "An all-in-one AI-powered tool for film commentary and automated video editing."
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.12"
|
||||||
|
dependencies = [
|
||||||
|
"requests>=2.32.0",
|
||||||
|
"moviepy==2.1.1",
|
||||||
|
"edge-tts==7.2.7",
|
||||||
|
"streamlit==1.56.0",
|
||||||
|
"watchdog==6.0.0",
|
||||||
|
"loguru>=0.7.3",
|
||||||
|
"tomli>=2.2.1",
|
||||||
|
"tomli-w>=1.0.0",
|
||||||
|
"pydub==0.25.1",
|
||||||
|
"pysrt==1.1.2",
|
||||||
|
"openai>=1.77.0",
|
||||||
|
"google-generativeai>=0.8.5",
|
||||||
|
"azure-cognitiveservices-speech>=1.37.0",
|
||||||
|
"tencentcloud-sdk-python>=3.0.1200",
|
||||||
|
"dashscope>=1.24.6",
|
||||||
|
"Pillow>=10.3.0",
|
||||||
|
"tqdm>=4.66.6",
|
||||||
|
"tenacity>=9.0.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.optional-dependencies]
|
||||||
|
twelvelabs = [
|
||||||
|
"twelvelabs>=1.2.8",
|
||||||
|
]
|
||||||
|
local-asr = [
|
||||||
|
"faster-whisper>=1.0.1",
|
||||||
|
]
|
||||||
|
opencv = [
|
||||||
|
"opencv-python>=4.11.0.86",
|
||||||
|
]
|
||||||
|
cuda = [
|
||||||
|
"torch>=2.0.0",
|
||||||
|
"torchvision>=0.15.0",
|
||||||
|
"torchaudio>=2.0.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[dependency-groups]
|
||||||
|
dev = [
|
||||||
|
"pytest>=8.0.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.uv]
|
||||||
|
package = false
|
||||||
Loading…
x
Reference in New Issue
Block a user