Skip to content

Commit 466e986

Browse files
committed
chore: fork settings
1 parent df8de7a commit 466e986

File tree

4 files changed

+54
-55
lines changed

4 files changed

+54
-55
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,11 @@ pip install -r requirements.txt
148148

149149
##### 3.1.1 采用 api 方式
150150

151-
`settings.toml` 文件中的 `ASR_METHOD` 参数设置为 `api`,然后填写 `WHISPER_API_KEY` 参数为你的 [API Key](https://console.groq.com/keys)。本项目采用 groq 提供 free tier 的 `whisper-large-v3-turbo` 模型,上传限制为 40 MB(约半小时),因此如需采用 api 识别的方式,请将视频录制分段调整为 30 分钟。此外,free tier 请求限制为 7200秒/20次/小时,28800秒/2000次/天。如果有更多需求,也欢迎升级到 dev tier,更多信息见[groq 官网](https://console.groq.com/docs/rate-limits)
151+
`bilive.toml` 文件中的 `ASR_METHOD` 参数设置为 `api`,然后填写 `WHISPER_API_KEY` 参数为你的 [API Key](https://console.groq.com/keys)。本项目采用 groq 提供 free tier 的 `whisper-large-v3-turbo` 模型,上传限制为 40 MB(约半小时),因此如需采用 api 识别的方式,请将视频录制分段调整为 30 分钟。此外,free tier 请求限制为 7200秒/20次/小时,28800秒/2000次/天。如果有更多需求,也欢迎升级到 dev tier,更多信息见[groq 官网](https://console.groq.com/docs/rate-limits)
152152

153153
##### 3.1.2 采用本地部署方式(需保证有 NVIDIA 显卡)
154154

155-
`settings.toml` 文件中的 `ASR_METHOD` 参数设置为 `deploy`,然后下载所需模型文件,并放置在 `src/subtitle/models` 文件夹中。
155+
`bilive.toml` 文件中的 `ASR_METHOD` 参数设置为 `deploy`,然后下载所需模型文件,并放置在 `src/subtitle/models` 文件夹中。
156156

157157
项目默认采用 [`small`](https://openaipublic.azureedge.net/main/whisper/models/9ecf779972d90ba49c06d968637d720dd632c55bbf19d441fb42bf17a411e794/small.pt) 模型,请点击下载所需文件,并放置在 `src/subtitle/models` 文件夹中。
158158

@@ -164,7 +164,7 @@ pip install -r requirements.txt
164164
165165
##### 3.2 MLLM 模型
166166

167-
MLLM 模型主要用于自动切片后的切片标题生成,此功能默认关闭,如果需要打开请将 `settings.toml` 文件中的 `AUTO_SLICE` 参数设置为 `True`。其他配置分别有:
167+
MLLM 模型主要用于自动切片后的切片标题生成,此功能默认关闭,如果需要打开请将 `bilive.toml` 文件中的 `AUTO_SLICE` 参数设置为 `True`。其他配置分别有:
168168
- `SLICE_DURATION` 以秒为单位设置切片时长(不建议超过 60 秒)。
169169
- `SLICE_NUM` 设置切片数量。
170170
- `SLICE_OVERLAP` 设置切片重叠时长。切片采用滑动窗口法处理,细节内容请见 [auto-slice-video](https://github.com/timerring/auto-slice-video)
@@ -173,27 +173,27 @@ MLLM 模型主要用于自动切片后的切片标题生成,此功能默认关
173173

174174
##### 3.2.1 GLM-4V-PLUS 模型
175175

176-
> 如需使用 GLM-4V-PLUS 模型,请将 `settings.toml` 文件中的 `MLLM_MODEL` 参数设置为 `zhipu`
176+
> 如需使用 GLM-4V-PLUS 模型,请将 `bilive.toml` 文件中的 `MLLM_MODEL` 参数设置为 `zhipu`
177177
178-
在项目的自动切片功能需要使用到智谱的 [`GLM-4V-PLUS`](https://bigmodel.cn/dev/api/normal-model/glm-4) 模型,请自行[注册账号](https://www.bigmodel.cn/invite?icode=shBtZUfNE6FfdMH1R6NybGczbXFgPRGIalpycrEwJ28%3D)并申请 API Key,填写到 `settings.toml` 文件中对应的 `ZHIPU_API_KEY` 中。
178+
在项目的自动切片功能需要使用到智谱的 [`GLM-4V-PLUS`](https://bigmodel.cn/dev/api/normal-model/glm-4) 模型,请自行[注册账号](https://www.bigmodel.cn/invite?icode=shBtZUfNE6FfdMH1R6NybGczbXFgPRGIalpycrEwJ28%3D)并申请 API Key,填写到 `bilive.toml` 文件中对应的 `ZHIPU_API_KEY` 中。
179179

180180
##### 3.2.2 Gemini 模型
181181

182-
> 如需使用 Gemini-2.0-flash 模型,请将 `settings.toml` 文件中的 `MLLM_MODEL` 参数设置为 `gemini`
182+
> 如需使用 Gemini-2.0-flash 模型,请将 `bilive.toml` 文件中的 `MLLM_MODEL` 参数设置为 `gemini`
183183
184-
在项目的自动切片功能需要使用到 Gemini-2.0-flash 模型,请自行[注册账号](https://aistudio.google.com/app/apikey)并申请 API Key,填写到 `settings.toml` 文件中对应的 `GEMINI_API_KEY` 中。
184+
在项目的自动切片功能需要使用到 Gemini-2.0-flash 模型,请自行[注册账号](https://aistudio.google.com/app/apikey)并申请 API Key,填写到 `bilive.toml` 文件中对应的 `GEMINI_API_KEY` 中。
185185

186186
##### 3.2.3 Qwen 模型
187187

188-
> 如需使用 Qwen-2.5-72B-Instruct 模型,请将 `settings.toml` 文件中的 `MLLM_MODEL` 参数设置为 `qwen`
188+
> 如需使用 Qwen-2.5-72B-Instruct 模型,请将 `bilive.toml` 文件中的 `MLLM_MODEL` 参数设置为 `qwen`
189189
190-
在项目的自动切片功能需要使用到 Qwen-2.5-72B-Instruct 模型,请自行[注册账号](https://bailian.console.aliyun.com/?apiKey=1)并申请 API Key,填写到 `settings.toml` 文件中对应的 `QWEN_API_KEY` 中。
190+
在项目的自动切片功能需要使用到 Qwen-2.5-72B-Instruct 模型,请自行[注册账号](https://bailian.console.aliyun.com/?apiKey=1)并申请 API Key,填写到 `bilive.toml` 文件中对应的 `QWEN_API_KEY` 中。
191191

192192
##### 3.2.4 Minimax 模型
193193

194-
> 如需使用 Minimax 模型,请将 `settings.toml` 文件中 `generate_cover` 参数设置为 `true`,并将 `IMAGE_GEN_MODEL` 参数设置为 `minimax`
194+
> 如需使用 Minimax 模型,请将 `bilive.toml` 文件中 `generate_cover` 参数设置为 `true`,并将 `IMAGE_GEN_MODEL` 参数设置为 `minimax`
195195
196-
在项目的自动切片功能需要使用到 Minimax 模型,请自行[注册账号](https://www.minimax.chat/)并申请 API Key,填写到 `settings.toml` 文件中对应的 `MINIMAX_API_KEY` 中。
196+
在项目的自动切片功能需要使用到 Minimax 模型,请自行[注册账号](https://www.minimax.chat/)并申请 API Key,填写到 `bilive.toml` 文件中对应的 `MINIMAX_API_KEY` 中。
197197

198198
#### 4. bilitool 登录
199199

@@ -258,7 +258,7 @@ logs # 日志文件夹
258258
#### 8. 配置上传参数
259259

260260
> [!TIP]
261-
> 上传默认参数如下,[]中内容全部自动替换。可以在 `settings.toml` 中自定义相关配置,映射关键词为 `{artist}``{date}``{title}``{source_link}`,可自行组合删减定制模板:
261+
> 上传默认参数如下,[]中内容全部自动替换。可以在 `bilive.toml` 中自定义相关配置,映射关键词为 `{artist}``{date}``{title}``{source_link}`,可自行组合删减定制模板:
262262
> + 标题模板是`{artist}直播回放-{date}-{title}`,效果为"【弹幕+字幕】[XXX]直播回放-[日期]-[直播间标题]",可自行修改。
263263
> + 简介模板是`{artist}直播,直播间地址:{source_link} 内容仅供娱乐,直播中主播的言论、观点和行为均由主播本人负责,不代表录播员的观点或立场。`,效果为"【弹幕+字幕】[XXX]直播,直播间地址:[https://live.bilibili.com/XXX] 内容仅供娱乐,直播中主播的言论、观点和行为均由主播本人负责,不代表录播员的观点或立场。",可自行修改。
264264
> + 默认标签是根据主播名字自动在 b 站搜索推荐中抓取的热搜词。

bilive.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# bilive Settings
2+
[model]
3+
model_type = "append" # Can be pipeline, append, merge
4+
5+
# WARNING!: If you choose "deploy" local inference:
6+
# 1. Please check the VRAM requirements twice!
7+
# 2. Please make sure you have installed the Nvidia GPU driver and can check the cuda via `nvcc -V`!
8+
# WARNING!: If you choose "api":
9+
# due to the limitation of free tier, you should keep every video less than 30 minutes(around)
10+
# which means your MODEL_TYPE should not be "merge".
11+
[asr]
12+
asr_method = "none" # can be "deploy" or "api" or "none"
13+
whisper_api_key = "" # Apply for your own API key at https://console.groq.com/keys
14+
inference_model = "small" # If you choose "deploy", you should download the inference model from https://openaipublic.azureedge.net/main/whisper/models/9ecf779972d90ba49c06d968637d720dd632c55bbf19d441fb42bf17a411e794/small.pt
15+
16+
[video]
17+
# You can change the title as you like, eg.
18+
# f"{artist}直播回放-{date}-{title}" - Streamer直播回放-20250328-Live title
19+
# f"{date}-{artist}直播回放" - 20250328-Streamer直播回放
20+
title = "{artist}直播回放-{date}-{title}" # Key words: {artist}, {date}, {title}, {source_link}
21+
description = "{artist}直播回放,直播间地址:{source_link} 内容仅供娱乐,直播中主播的言论、观点和行为均由主播本人负责,不代表录播员的观点或立场。" # Key words: {artist}, {date}, {title}, {source_link}
22+
gift_price_filter = 1 # The gift whose price is less than this value will be filtered, unit: RMB
23+
reserve_for_fixing = false # If encounter MOOV crash error, delete the video or reserve for fixing
24+
upload_line = "auto" # The upload line to be used, default None is auto detect(recommended), if you want to specify, it can be "bldsa", "ws", "tx", "qn", "bda2".
25+
26+
[slice]
27+
auto_slice = false # General control: true or false
28+
slice_duration = 60 # better not exceed 300 seconds
29+
slice_num = 2 # the number of slices
30+
slice_overlap = 30 # the overlap of slices(seconds) see my package https://github.com/timerring/auto-slice-video for more details
31+
slice_step = 1 # the step of slices(seconds)
32+
min_video_size = 200 # The minimum video size to be sliced (MB)
33+
mllm_model = "gemini" # the multi-model LLMs, can be "gemini" or "zhipu" or "qwen"
34+
zhipu_api_key = "" # Apply for your own GLM-4v-Plus API key at https://www.bigmodel.cn/invite?icode=shBtZUfNE6FfdMH1R6NybGczbXFgPRGIalpycrEwJ28%3D
35+
gemini_api_key = "" # Apply for your own Gemini API key at https://aistudio.google.com/app/apikey
36+
qwen_api_key = "" # Apply for your own Qwen API key at https://bailian.console.aliyun.com/?apiKey=1
37+
38+
[cover]
39+
generate_cover = false # whether to generate cover
40+
image_gen_model = "minimax" # the image generation model, can be "minimax"
41+
minimax_api_key = "" # Apply for your own Minimax API key at https://platform.minimaxi.com/user-center/basic-information/interface-key

settings.toml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,6 @@
11
version = "1.0"
22
webhooks = []
33

4-
# bilive Settings
5-
[model]
6-
model_type = "append" # Can be pipeline, append, merge
7-
8-
# WARNING!: If you choose "deploy" local inference:
9-
# 1. Please check the VRAM requirements twice!
10-
# 2. Please make sure you have installed the Nvidia GPU driver and can check the cuda via `nvcc -V`!
11-
# WARNING!: If you choose "api":
12-
# due to the limitation of free tier, you should keep every video less than 30 minutes(around)
13-
# which means your MODEL_TYPE should not be "merge".
14-
[asr]
15-
asr_method = "none" # can be "deploy" or "api" or "none"
16-
whisper_api_key = "" # Apply for your own API key at https://console.groq.com/keys
17-
inference_model = "small" # If you choose "deploy", you should download the inference model from https://openaipublic.azureedge.net/main/whisper/models/9ecf779972d90ba49c06d968637d720dd632c55bbf19d441fb42bf17a411e794/small.pt
18-
19-
[video]
20-
# You can change the title as you like, eg.
21-
# f"{artist}直播回放-{date}-{title}" - Streamer直播回放-20250328-Live title
22-
# f"{date}-{artist}直播回放" - 20250328-Streamer直播回放
23-
title = "{artist}直播回放-{date}-{title}" # Key words: {artist}, {date}, {title}, {source_link}
24-
description = "{artist}直播回放,直播间地址:{source_link} 内容仅供娱乐,直播中主播的言论、观点和行为均由主播本人负责,不代表录播员的观点或立场。" # Key words: {artist}, {date}, {title}, {source_link}
25-
gift_price_filter = 1 # The gift whose price is less than this value will be filtered, unit: RMB
26-
reserve_for_fixing = false # If encounter MOOV crash error, delete the video or reserve for fixing
27-
upload_line = "auto" # The upload line to be used, default None is auto detect(recommended), if you want to specify, it can be "bldsa", "ws", "tx", "qn", "bda2".
28-
29-
[slice]
30-
auto_slice = false # General control: true or false
31-
slice_duration = 60 # better not exceed 300 seconds
32-
slice_num = 2 # the number of slices
33-
slice_overlap = 30 # the overlap of slices(seconds) see my package https://github.com/timerring/auto-slice-video for more details
34-
slice_step = 1 # the step of slices(seconds)
35-
min_video_size = 200 # The minimum video size to be sliced (MB)
36-
mllm_model = "gemini" # the multi-model LLMs, can be "gemini" or "zhipu" or "qwen"
37-
zhipu_api_key = "" # Apply for your own GLM-4v-Plus API key at https://www.bigmodel.cn/invite?icode=shBtZUfNE6FfdMH1R6NybGczbXFgPRGIalpycrEwJ28%3D
38-
gemini_api_key = "" # Apply for your own Gemini API key at https://aistudio.google.com/app/apikey
39-
qwen_api_key = "" # Apply for your own Qwen API key at https://bailian.console.aliyun.com/?apiKey=1
40-
41-
[cover]
42-
generate_cover = false # whether to generate cover
43-
image_gen_model = "minimax" # the image generation model, can be "minimax"
44-
minimax_api_key = "" # Apply for your own Minimax API key at https://platform.minimaxi.com/user-center/basic-information/interface-key
45-
464
# blrec Settings
475
[[tasks]]
486
room_id = 173551

src/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def get_interface_config():
4545
print("Initialize the database", flush=True)
4646
create_table()
4747

48-
config = load_config_from_toml(os.path.join(BILIVE_DIR, 'settings.toml'))
48+
config = load_config_from_toml(os.path.join(BILIVE_DIR, 'bilive.toml'))
4949
if config is None:
5050
print("failed to load config file, please check twice", flush=True)
5151
exit(1)

0 commit comments

Comments
 (0)