Skip to content

Commit da16e54

Browse files
committed
i18n: update
1 parent 249fb3e commit da16e54

File tree

5 files changed

+154
-92
lines changed

5 files changed

+154
-92
lines changed

config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: "2.0.0"
33
## ======================== Basic Settings ======================== ##
44
# API settings
55
api:
6-
key: 'sk-hhfvwvtaqcbsshswzeyuvvxwpgnskrjqnvxhcxzjlzripizd'
6+
key: 'YOUR_API_KEY'
77
base_url: 'https://api.siliconflow.cn'
88
model: 'Qwen/Qwen2.5-72B-Instruct'
99

@@ -25,7 +25,7 @@ resolution: '1920x1080'
2525

2626
## ======================== Advanced Settings ======================== ##
2727
# *Default resolution for downloading YouTube videos [360, 1080, best]
28-
ytb_resolution: '360'
28+
ytb_resolution: '1080'
2929

3030
subtitle:
3131
# *Maximum length of each subtitle line in characters

i18n/中文/config.yaml

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
# * 标有 * 的设置是高级设置,不会出现在 Streamlit 页面中,只能在 config.py 中手动修改
2+
version: "2.0.0"
23
## ======================== 基本设置 ======================== ##
34
# API 设置
45
api:
5-
key: 'YOUR_KEY'
6-
base_url: 'https://yunwu.zeabur.app'
7-
model: 'gemini-1.5-pro-002'
6+
key: 'YOUR_API_KEY'
7+
base_url: 'https://api.siliconflow.cn'
8+
model: 'Qwen/Qwen2.5-72B-Instruct'
89

910
# 语言设置,写入提示词,可以用自然语言描述
10-
target_language: 'Chinese'
11+
target_language: '简体中文'
1112

1213
# 是否在转录前进行人声分离,警告这可能会减慢过程并导致行缺失!
1314
demucs: false
1415

1516
whisper:
16-
# Whisper 设置 [whisperx, whisperxapi]
17-
method: 'whisperx'
18-
# Whisper 指定识别语言 [en, zh, auto] auto 为自动检测,en 为强制翻译为英语
17+
# ["medium", "large-v3", "large-v3-turbo"]. 注意:对于中文模型将强制使用 Belle/large-v3
18+
model: 'large-v3'
19+
# Whisper 指定识别语言 [en, zh, ...]
1920
language: 'en'
2021
detected_language: 'en'
2122

2223
# 视频分辨率 [0x0, 640x360, 1920x1080] 0x0 会生成一个 0 秒的黑色视频占位符
23-
resolution: '640x360'
24+
resolution: '1920x1080'
2425

2526
## ======================== 高级设置 ======================== ##
2627
# *下载 YouTube 视频的默认分辨率 [360, 1080, best]
27-
ytb_resolution: '360'
28+
ytb_resolution: '1080'
2829

2930
subtitle:
3031
# *每行字幕的最大字符长度
@@ -41,8 +42,20 @@ max_split_length: 20
4142
pause_before_translate: false
4243

4344
## ======================== 配音设置 ======================== ##
44-
# TTS 选择 [openai_tts, gpt_sovits, azure_tts, fish_tts]
45-
tts_method: 'azure_tts'
45+
# TTS 选择 [sf_fish_tts, openai_tts, gpt_sovits, azure_tts, fish_tts]
46+
tts_method: 'sf_fish_tts'
47+
48+
# SiliconFlow FishTTS
49+
sf_fish_tts:
50+
# SiliconFlow API key
51+
api_key: 'YOUR_API_KEY'
52+
# 仅用于 "preset" 模式
53+
voice: 'anna'
54+
# *仅用于 "custom" 模式,不要手动设置
55+
custom_name: ''
56+
voice_id: ''
57+
# preset, custom, dynamic
58+
mode: "preset"
4659

4760
# OpenAI TTS-1 API 配置
4861
openai_tts:
@@ -72,15 +85,21 @@ fish_tts:
7285
# *音频速度范围
7386
speed_factor:
7487
min: 1
88+
accept: 1.2 # 可以接受的最大速度
7589
max: 1.4
76-
normal: 1.2 # *被认为是正常语速
7790

7891
# *合并音频配置
79-
min_subtitle_duration: 3
80-
min_trim_duration: 2.50
92+
min_subtitle_duration: 2.5 # 最小字幕出现时间 会强制扩展
93+
min_trim_duration: 3.5 # 小于这个值的字幕不会切割
94+
tolerance: 1.5 # 允许向后延申的时间
8195

8296
# 音量设置
83-
dub_volume: 1.3 # *配音音频音量(1.3 = 130%,大多数原始配音音频相对较安静)
97+
dub_volume: 1.5 # *配音音频音量(1.5 = 150%,大多数原始配音音频相对较安静)
98+
99+
100+
101+
102+
84103

85104
## ======================== 附加设置 请勿修改 ======================== ##
86105
# Whisper 模型目录
@@ -96,7 +115,6 @@ allowed_video_formats:
96115
- 'wmv'
97116
- 'webm'
98117

99-
# 支持的音频格式
100118
allowed_audio_formats:
101119
- 'wav'
102120
- 'mp3'
@@ -112,6 +130,11 @@ llm_support_json:
112130
- 'gemini-1.5-pro-latest'
113131
- 'gemini-1.5-pro-002'
114132

133+
# 存在问题
134+
# - 'Qwen/Qwen2.5-72B-Instruct'
135+
# - 'Qwen/Qwen2.5-Coder-32B-Instruct'
136+
# - 'Qwen/Qwen2.5-Chat-72B-Instruct-128K'
137+
115138
# Spacy 模型
116139
spacy_model_map:
117140
en: 'en_core_web_md'

i18n/中文/install.py

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,62 @@
44
import sys
55
import zipfile
66
import shutil
7-
87
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
98

9+
ascii_logo = """
10+
__ ___ _ _ _
11+
\ \ / (_) __| | ___ ___ | | (_)_ __ __ _ ___
12+
\ \ / /| |/ _` |/ _ \/ _ \| | | | '_ \ / _` |/ _ \
13+
\ V / | | (_| | __/ (_) | |___| | | | | (_| | (_) |
14+
\_/ |_|\__,_|\___|\___/|_____|_|_| |_|\__, |\___/
15+
|___/
16+
"""
17+
1018
def install_package(*packages):
1119
subprocess.check_call([sys.executable, "-m", "pip", "install", *packages])
1220

13-
install_package("requests", "rich", "ruamel.yaml")
14-
from core.pypi_autochoose import main as choose_mirror
15-
1621
def check_gpu():
17-
"""检查是否有 NVIDIA GPU 可用"""
1822
try:
19-
# 🔍 尝试运行 nvidia-smi 命令来检测 GPU
2023
subprocess.run(['nvidia-smi'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
2124
return True
2225
except (subprocess.CalledProcessError, FileNotFoundError):
2326
return False
2427

2528
def main():
29+
install_package("requests", "rich", "ruamel.yaml")
2630
from rich.console import Console
2731
from rich.panel import Panel
28-
32+
from rich.box import DOUBLE
2933
console = Console()
34+
35+
width = max(len(line) for line in ascii_logo.splitlines()) + 4
36+
welcome_panel = Panel(
37+
ascii_logo,
38+
width=width,
39+
box=DOUBLE,
40+
title="[bold green]🌏[/bold green]",
41+
border_style="bright_blue"
42+
)
43+
console.print(welcome_panel)
44+
3045
console.print(Panel.fit("🚀 开始安装", style="bold magenta"))
3146

3247
# 配置镜像源
33-
console.print(Panel("⚙️ 正在配置镜像源", style="bold yellow"))
48+
from core.pypi_autochoose import main as choose_mirror
3449
choose_mirror()
3550

36-
# 检测系统和 GPU
51+
# 检测系统和GPU
3752
if platform.system() == 'Darwin':
38-
console.print(Panel("🍎 检测到 MacOS,正在安装 CPU 版本的 PyTorch... 但速度会慢很多", style="cyan"))
39-
subprocess.check_call([sys.executable, "-m", "pip", "install", "torch", "torchaudio"])
53+
console.print(Panel("🍎 检测到 MacOS,正在安装 CPU 版本的 PyTorch... 但转写速度会慢很多", style="cyan"))
54+
subprocess.check_call([sys.executable, "-m", "pip", "install", "torch==2.1.2", "torchaudio==2.1.2"])
4055
else:
4156
has_gpu = check_gpu()
4257
if has_gpu:
4358
console.print(Panel("🎮 检测到 NVIDIA GPU,正在安装 CUDA 版本的 PyTorch...", style="cyan"))
4459
subprocess.check_call([sys.executable, "-m", "pip", "install", "torch==2.0.0", "torchaudio==2.0.0", "--index-url", "https://download.pytorch.org/whl/cu118"])
4560
else:
46-
console.print(Panel("💻 未检测到 NVIDIA GPU,正在安装 CPU 版本的 PyTorch... 但速度会慢很多", style="cyan"))
47-
subprocess.check_call([sys.executable, "-m", "pip", "install", "torch", "torchaudio"])
61+
console.print(Panel("💻 未检测到 NVIDIA GPU,正在安装 CPU 版本的 PyTorch... 但转写速度会慢很多", style="cyan"))
62+
subprocess.check_call([sys.executable, "-m", "pip", "install", "torch==2.1.2", "torchaudio==2.1.2"])
4863

4964
# 安装 WhisperX
5065
console.print(Panel("📦 正在安装 WhisperX...", style="cyan"))
@@ -65,6 +80,10 @@ def install_requirements():
6580
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
6681

6782
def download_and_extract_ffmpeg():
83+
# 需要同时安装 conda-ffmpeg 和 ffmpeg.exe
84+
console.print(Panel("📦 正在通过 conda 安装 ffmpeg...", style="cyan"))
85+
subprocess.check_call(["conda", "install", "-y", "ffmpeg"])
86+
6887
import requests
6988
system = platform.system()
7089
if system == "Windows":
@@ -83,15 +102,15 @@ def download_and_extract_ffmpeg():
83102
print(f"{ffmpeg_exe} 已存在")
84103
return
85104

86-
print("正在下载 FFmpeg")
105+
console.print(Panel("📦 正在下载 FFmpeg...", style="cyan"))
87106
response = requests.get(url)
88107
if response.status_code == 200:
89108
filename = "ffmpeg.zip" if system in ["Windows", "Darwin"] else "ffmpeg.tar.xz"
90109
with open(filename, 'wb') as f:
91110
f.write(response.content)
92-
print(f"FFmpeg 下载完成: {filename}")
111+
console.print(Panel(f"FFmpeg 下载完成: {filename}", style="cyan"))
93112

94-
print("正在解压 FFmpeg")
113+
console.print(Panel("📦 正在解压 FFmpeg...", style="cyan"))
95114
if system == "Linux":
96115
import tarfile
97116
with tarfile.open(filename) as tar_ref:
@@ -106,15 +125,15 @@ def download_and_extract_ffmpeg():
106125
zip_ref.extract(file)
107126
shutil.move(os.path.join(*file.split('/')[:-1], os.path.basename(file)), os.path.basename(file))
108127

109-
print("正在清理")
128+
console.print(Panel("📦 正在清理...", style="cyan"))
110129
os.remove(filename)
111130
if system == "Windows":
112131
for item in os.listdir():
113132
if os.path.isdir(item) and "ffmpeg" in item.lower():
114133
shutil.rmtree(item)
115-
print("FFmpeg 解压完成")
134+
console.print(Panel("FFmpeg 解压完成", style="cyan"))
116135
else:
117-
print("FFmpeg 下载失败")
136+
console.print(Panel("❌ FFmpeg 下载失败", style="red"))
118137

119138
def install_noto_font():
120139
if platform.system() == 'Linux':

0 commit comments

Comments
 (0)