Streamlit AttributeError:模块“streamlit”没有属性“chat_input”

问题描述 投票:0回答:1

这是我第一次使用streamlit,如何解决AttributeError?谢谢你! #Streamlit,版本1.33.0(streamlit版本),3.8.16(python版本)

import streamlit as st

prompt: str = st.chat_input("Enter a prompt here")

USER = "user"
ASSISTANT = "assistant"

if prompt:
    st.chat_message(USER).write(prompt)
    st.chat_message(ASSISTANT).write(f"You wrote {prompt}")
attributeerror streamlit
1个回答
0
投票

你的代码没问题,我可以运行它 也许你需要升级你的python版本 我的是Python 3.10.6

© www.soinside.com 2019 - 2024. All rights reserved.