Warning (from warnings module): File "C:\Users\LY-AI\Desktop\AI\vits_chinese-2.0\vits_chinese-2.0\app.py", line 66 return "成功", gr.outputs.File(output_filepath) GradioDeprecationWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components DEBUG:matplotlib.pyplot:Loaded backend TkAgg version 8.6. Traceback (most recent call last): File "C:\Users\LY-AI\Desktop\AI\vits_chinese-2.0\python3.9.13\3.9.13\lib\site-packages\gradio\routes.py", line 442, in run_predict output = await app.get_blocks().process_api( File "C:\Users\LY-AI\Desktop\AI\vits_chinese-2.0\python3.9.13\3.9.13\lib\site-packages\gradio\blocks.py", line 1392, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "C:\Users\LY-AI\Desktop\AI\vits_chinese-2.0\python3.9.13\3.9.13\lib\site-packages\gradio\blocks.py", line 1326, in postprocess_data prediction_value = block.postprocess(prediction_value) File "C:\Users\LY-AI\Desktop\AI\vits_chinese-2.0\python3.9.13\3.9.13\lib\site-packages\gradio\components\audio.py", line 334, in postprocess file_path = self.make_temp_copy_if_needed(y) File "C:\Users\LY-AI\Desktop\AI\vits_chinese-2.0\python3.9.13\3.9.13\lib\site-packages\gradio\components\base.py", line 226, in make_temp_copy_if_needed temp_dir = self.hash_file(file_path) File "C:\Users\LY-AI\Desktop\AI\vits_chinese-2.0\python3.9.13\3.9.13\lib\site-packages\gradio\components\base.py", line 190, in hash_file with open(file_path, "rb") as f: TypeError: expected str, bytes or os.PathLike object, not File
时间: 2023-08-05 14:10:11 浏览: 246
GTK+_2.0中文手册
5星 · 资源好评率100%
非常抱歉,我之前的回答还是有误在 Gradio 中,确实不再支持 `gradio.outputs` 模块,而是改为使用 `gradio.components` 模块。此外,`gradio.components.File` 类也没有 `mime_type` 这个关键字参数。
下面是修改后的代码示例:
```python
import gradio as gr
def create_callback(net_g: SynthesizerTrn, tts_front: VITS_PinYin):
def tts_callback(text, dur_scale):
# 其他代码省略...
# 修改下载文件的默认存放位置
output_filepath = "/path/to/output/file.wav" # 指定下载文件的存放路径
return "成功", gradio.components.File(output_filepath)
return tts_callback
```
请确保您已经导入了 `gradio` 模块,并使用 `gradio.components.File` 创建文件下载的输出。
非常抱歉给您带来的困扰,希望这次修改能够解决问题。如有任何其他问题,请随时提问!
阅读全文