“Streamlit 中的文本输入在按下 Enter 键后会删除输入的文本:如何修复?”

问题描述 投票:0回答:2
the input stored in user_question i need when press enter the txt in textbox getting clear and the output displing what can i did i tried js and streamlit function but when enter input and press send btn or press enter no output displaying 

enter image description here

这是一个图像输入单词按下的示例,然后输入
文本框没看清楚

python nlp artificial-intelligence streamlit large-language-model
2个回答
0
投票

看来,你必须做一个功能才能清除它

像这样:

import streamlit as st

def clear_text():
    st.session_state["text"] = ""

input = st.text_input("text", key="text")    
st.button("clear text input", on_click=clear_text)
st.write(input)

正如这里所解释的:streamlit问题


0
投票

您可以使用

聊天输入

文档) 这个组件完全可以做你想做的事情

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