①IMPORTANT: You are using gradio version 3.49.0, however version 4.29.0 is available, please upgrade
原因分析:
因为使用的gradio版本过高,使用较低版本。
pip install gradio==3.49.0
会有提示IMPORTANT: You are using gradio version 3.49.0, however version 4.29.0 is available, please upgrade.:
Running on local URL: http://127.0.0.1:7862
To create a public link, set `share=True` in `launch()`.
IMPORTANT: You are using gradio version 3.49.0, however version 4.29.0 is available, please upgrade.
此时将在公网访问的功能打开
在源码目录中修改web_demo.py的最后一行,将share=False修改为share=True:
demo.queue().launch(share=True, inbrowser=True)
②AttributeError: 'Textbox' object has no attribute 'style'. Did you mean: 'scale'
原因分析:
gradio高版本舍弃了部分方法
AttributeError: 'Textbox' object has no attribute 'style'. Did you mean: 'scale'?
此时需要修改源码中的
修改成以下格式,就能在内网、公网上正常访问:
user_input = gr.Textbox(show_label=False, placeholder="Input...", lines=10,
container=False)
解决以上问题,就能成功访问: