【求助】streamlit页面更新方法 st.experimental_rerun() 报错误 #227
Labels
No Label
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: HswOAuth/llm_course#227
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
我做了一个文件上传/下载功能(方便后面Rag里面使用),
文件删除时,调用了st.experimental_rerun() ,报错。
代码
col1, col2, col3, col4 = st.columns([3, 1, 1, 5])
with col1:
st.write(file_name)
with col2:
download_key = f"download_{file_name}"
download_button = st.download_button(
label="Download",
data=open(file_path, "rb"),
file_name=file_name,
mime=file_type,
key=download_key
)
with col3:
# 删除按钮
delete_key = f"delete_{file_name}"
if st.button("Delete", key=file_name):
if delete_file(file_name):
st.success(f"文件 '{file_name}' 已成功删除。")
st.experimental_rerun()
else:
st.error(f"删除文件 '{file_name}' 失败。")
错误:

st.rerun() 用这个试试