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 1389, in process_api result = await self.call_function( File "C:\Users\LY-AI\Desktop\AI\vits_chinese-2.0\python3.9.13\3.9.13\lib\site-packages\gradio\blocks.py", line 1094, in call_function prediction = await anyio.to_thread.run_sync( File "C:\Users\LY-AI\Desktop\AI\vits_chinese-2.0\python3.9.13\3.9.13\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\Users\LY-AI\Desktop\AI\vits_chinese-2.0\python3.9.13\3.9.13\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "C:\Users\LY-AI\Desktop\AI\vits_chinese-2.0\python3.9.13\3.9.13\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run result = context.run(func, *args) File "C:\Users\LY-AI\Desktop\AI\vits_chinese-2.0\python3.9.13\3.9.13\lib\site-packages\gradio\utils.py", line 703, in wrapper response = f(*args, **kwargs) File "C:\Users\LY-AI\Desktop\AI\vits_chinese-2.0\vits_chinese-2.0\app.py", line 65, in tts_calback return "成功", gradio.outputs.Download(output_filepath, mime_type="audio/wav") NameError: name 'gradio' is not defined
时间: 2023-07-28 07:09:26 浏览: 195
Mac下anaconda中Spyder打开报错Traceback(most recent call last)…问题
5星 · 资源好评率100%
这个错误表明在您的代码中缺少对 `gradio` 的引入。您需要确保在使用 `gradio` 的相关功能之前,先导入 `gradio` 模块。
请确保在代码开头添加以下导入语句:
```python
import gradio as gr
```
这样就可以解决 `NameError: name 'gradio' is not defined` 错误了。重新运行代码时,确保已导入 `gradio` 模块,然后再试一次。
阅读全文