LangChat-NJU部署到公网云服务器

240 阅读1分钟

前期准备

在开通公网云服务器时,注意开通端口的公网访问。如本次在matpool矩池云,开通了8501端口,云服务商会给出对应的公网地址(记作public_host_client:public_port_client)。还开通了7861端口,公网地址记作public_host_server:public_port_server。

后端

llm_api.py正常跑就行,host在0.0.0.0,所有端口都不用更改。

api.py,host在0.0.0.0,端口为7861。

前端

前端要去request的后端地址为http://localhost/7861 (注意,不需要用云服务商提供的公网地址)。 前端streamlit的运行端口设置为8501。

然后就可以通过public_host_client:public_port_client访问web app了。此时也可以在浏览器直接通过public_host_server:public_port_server访问fastapi给出的api文档页面。