欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 社会 > 【随手记】支持多模态输入的 AI Chatbot App

【随手记】支持多模态输入的 AI Chatbot App

2025/5/11 12:30:59 来源:https://blog.csdn.net/lbp0123456/article/details/146484223  浏览:    关键词:【随手记】支持多模态输入的 AI Chatbot App

一、Streamlit

1、Streamlit开发文档

官方文档:https://docs.streamlit.io/

中文文档:https://blog.csdn.net/weixin_44458771/article/details/135495928

2、Streamlit命令行启动

pip install streamlit
streamlit run app.py --server.port 8501

3、配置Pycharm调试Streamlit应用

开发环境

PyCharm Community Edition 2024

Win10/11

Streamlit 1.39.0

3.1、创建应用

app.py

import streamlit as stst.header("hello")
st.write("this is a streamlit demo")

3.2、启动应用

设置参数:

script:D:/software/python/python-3.12.4/.venv/Scripts/streamlit

script parameters:run app.py

3.3、调试应用

点击调试按钮会报错。

经过分析,是因为选择的script, 文件名为D:/software/python/python-3.12.4/.venv/Scripts/streamlit.exe

streamlit.exe 是一个二进制文件,导致字符集解析出错。在这里把 linux 环境下的 streamlit 复制过来。

#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from streamlit.web.cli import main
if __name__ == '__main__':sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])sys.exit(main())

复制到 D:/software/python/python-3.12.4/.venv/Scripts/

再次启动 debug 按钮,报错如下

解决如下:

Help | Find Action | Registry | python.debug.asyncio.repl 去掉勾。

再次点击 debug 就可以正常调试了。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词