《英伟达-本地AI》--NVIDIA Chat with RTX--部署问题:ValueError: When localhost is not accessible

2024-03-20 1084阅读

温馨提示:这篇文章已超过435天没有更新,请注意相关的内容是否还可用!

部署英伟达本地AI: 

英伟达-本地AI》--NVIDIA Chat with RTX-简单本机部署

出现;

ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your

proxy settings to allow access to localhost.

阿丹:

        在部署NVIDIA Chat with RTX的时候出现了一个比较奇怪的问题。但是解决掉了,这里做一些记录。

描述:

在成功运行了之后出现这个报错,尝试解决

《英伟达-本地AI》--NVIDIA Chat with RTX--部署问题:ValueError: When localhost is not accessible发现后台dos窗口出现

《英伟达-本地AI》--NVIDIA Chat with RTX--部署问题:ValueError: When localhost is not accessible

这个报错

Running on local URL:  http://127.0.0.1:30733
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\ai-NVIDIA\RAG\trt-llm-rag-windows-main\app.py:501 in                                  │
│    │
│   498                                             │
│   499 interface.on_regenerate_index(handle_regenerate_index)                                     │
│   500 # render the interface                      │
│ ❱ 501 interface.render()                          │
│   502                                             │
│    │
│ C:\ai-NVIDIA\RAG\trt-llm-rag-windows-main\ui\user_interface.py:254 in render                     │
│    │
│    251 │   │   interface.queue()                  │
│    252 │   │   port = self._get_free_port()       │
│    253 │   │   self._open_app(port)               │
│ ❱  254 │   │   interface.launch(                  │
│    255 │   │   │   favicon_path=os.path.join(os.path.dirname(__file__), 'assets/nvidia_logo.png  │
│    256 │   │   │   show_api=False,                │
│    257 │   │   │   server_port=port,              │
│    │
│ C:\ai-NVIDIA\env_nvd_rag\lib\site-packages\gradio\blocks.py:1990 in launch                       │
│    │
│   1987 │   │   │   and not networking.url_ok(self.local_url)                                     │
│   1988 │   │   │   and not self.share             │
│   1989 │   │   ):                                 │
│ ❱ 1990 │   │   │   raise ValueError(              │
│   1991 │   │   │   │   "When localhost is not accessible, a shareable link must be created. Ple  │
│   1992 │   │   │   )                              │
│   1993                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your
proxy settings to allow access to localhost.

其中核心为:

ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your

proxy settings to allow access to localhost.

说明:

根据错误信息和代码片段,正在尝试运行一个基于Gradio库构建的应用程序(gradio.blocks.py 文件),并且在尝试启动本地服务器并渲染用户界面时遇到了问题。错误提示指出由于本地主机无法访问,因此要求创建一个可共享链接,并建议通过设置 share=True 来解决。

要解决这个问题,请找到在 app.py 或者初始化 Gradio 接口的地方,并确保在调用相关方法启动应用时包含了 share=True 参数。例如,在 user_interface.py 文件中的第 254 行,应该有一个类似于以下的调用:

interface.launch(..., share=True, ...)

这样当本地主机不可达时,Gradio 将尝试创建一个可以通过网络访问的临时公共 URL。请确认防火墙和代理设置允许对外部访问,并且在必要时允许对本地主机的访问。同时,注意在某些情况下,启用 share=True 可能需要额外的权限或配置,比如需要有效的互联网连接来托管临时服务器。

解决:

找到安装这个Ai的路径

《英伟达-本地AI》--NVIDIA Chat with RTX--部署问题:ValueError: When localhost is not accessible

在这个根路径后面直接添加路径

\RAG\trt-llm-rag-windows-main\ui

找到如图所示的路径下面: 

《英伟达-本地AI》--NVIDIA Chat with RTX--部署问题:ValueError: When localhost is not accessible

 编辑user_interface.py文件

《英伟达-本地AI》--NVIDIA Chat with RTX--部署问题:ValueError: When localhost is not accessible

在这里追加属性:

share=True

《英伟达-本地AI》--NVIDIA Chat with RTX--部署问题:ValueError: When localhost is not accessible

 保存文件。开启科学上网环境,重启尝试。

《英伟达-本地AI》--NVIDIA Chat with RTX--部署问题:ValueError: When localhost is not accessible

可以正常交互!完成部署!问题解决。 

VPS购买请点击我

免责声明:我们致力于保护作者版权,注重分享,被刊用文章因无法核实真实出处,未能及时与作者取得联系,或有版权异议的,请联系管理员,我们会立即处理! 部分文章是来自自研大数据AI进行生成,内容摘自(百度百科,百度知道,头条百科,中国民法典,刑法,牛津词典,新华词典,汉语词典,国家院校,科普平台)等数据,内容仅供学习参考,不准确地方联系删除处理! 图片声明:本站部分配图来自人工智能系统AI生成,觅知网授权图片,PxHere摄影无版权图库和百度,360,搜狗等多加搜索引擎自动关键词搜索配图,如有侵权的图片,请第一时间联系我们,邮箱:ciyunidc@ciyunshuju.com。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!

目录[+]