#7056 Parameter `lang_choice` is not a valid key-word argument. Please click on 'view API' in the footer of the Gradio app to

27.17**0 Posted at: 1 hour ago

Parameter lang_choice is not a valid key-word argument. Please click on 'view API' in the footer of the Gradio app to see usage.:
{'text': '你好啊,我亲爱的朋友,希望你的每一天都是美好愉快的!', 'role': 'zh_female_tw.wav', 'filename': 'G:/win-pyvideotrans-v4.11/tmp/23508/1788517059.291235-12.wav', 'tts_type': 12}
Traceback (most recent call last):
File "videotrans\util\ListenVoice.py", line 21, in run
File "videotrans\tts\__init__.py", line 233, in run
File "videotrans\tts\_base.py", line 130, in run
videotrans.configure.excepts.DubbingSrtError: Parameter lang_choice is not a valid key-word argument. Please click on 'view API' in the footer of the Gradio app to see usage.


=
system:Windows-10-10.0.19045-SP0
version:v4.11
frozen:True
language:zh
root_dir:G:/win-pyvideotrans-v4.11

3 Replies

#1 DeepSeek reply at 1 hour ago

这是 gradio_api.txt 配置文件中的参数名与你实际使用的 Gradio 应用 API 不匹配导致的。你填写的 lang_choice 不是该应用的有效关键字参数。

解决方案:

  1. 打开该 TTS 的 WebUI 页面,滚动到底部,点击 “Use via API”(或“通过API使用”)。
  2. 找到负责生成克隆音频的接口,查看实际接受的所有参数名,注意参数名区分大小写。例如该应用可能实际使用 lang 而不是 lang_choice
  3. 进入 pyVideoTrans 软件根目录,打开 gradio_api.txt,将 lang_choice=ZH 替换为实际参数名,例如 lang=ZH;如果该应用根本没有语言参数,则直接删除这一行。
  4. 保存文件,重新执行配音。

如果修改后仍有其他参数报错,请按同样方法核对每一个参数名,尤其是标记为 Literal[...] 的单选参数,其值必须完全等于方括号内列出的某项。

请查阅相关文档:

#2 27.17**0 reply at 1 hour ago

pyvideotrans-v4,没有gradio_api.txt

#3 DeepSeek reply at 1 hour ago

gradio_api.txt 文件需要手动创建,软件默认不会自带。你的报错说明已经向该 Gradio 接口传递了 lang_choice 参数,但该参数并非你所对接的 TTS WebUI 接口的有效参数。

请按以下步骤操作:

  1. 定位软件根目录:进入 sp.exesp.py 所在的文件夹(即 G:/win-pyvideotrans-v4.11)。
  2. 新建配置文件:在该目录下新建一个文本文件,命名为 gradio_api.txt(注意:必须为小写 .txt,不要加其他后缀)。
  3. 查看目标 TTS 的实际 API 参数:打开你正在使用的 TTS WebUI 页面,滚动到页面底部,点击 Use via API(或“通过API使用”)。找到负责生成克隆音频的接口,查看其实际接受的参数名,并注意区分大小写、以及 Literal[...] 枚举值必须完全一致。
  4. 修改参数内容:用记事本打开 gradio_api.txt,将不符合的 lang_choice=ZH 改为真实参数名。例如:

    • 如果接口实际参数是 lang,则写为 lang=ZH
    • 如果该接口根本没有语言参数,则直接删除这一行。
  5. 保存文件并重新执行配音

如果修改后还有其他参数报错,请逐一对照 API 接口定义修正每一个参数名,尤其是必填项和枚举项。

请查阅相关文档:

Thinking...
Post Your Reply
If you have more than 50 messages, you will no longer receive an automatic reply. Please ask a new question!
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Dondate via ko-fi.com

Related resource