【问题标题】:Hide bottom HTML/widget, and remove Drag & Drop from Streamlit file_uploader()隐藏底部 HTML/widget,并从 Streamlit file_uploader() 中删除拖放
【发布时间】:2021-03-06 23:33:38
【问题描述】:
我使用 Streamlit 创建了一个应用程序,它需要一次读取多个文件。我正在使用带有参数accept_multiple_files=True 的file_uploader() 组件。
我有 2 个问题:
- 首先,是否有办法隐藏在上传文件后出现的底部 HTML/Widget(见下图)?
- 其次,如果有办法删除拖放选项,只需留下“浏览文件”切换按钮?
【问题讨论】:
标签:
python
html
python-3.x
streamlit
【解决方案1】:
目前最好的解决方案是使用st.beta_expander() 隐藏st.file_uploader(),而无需以编程方式使用重新运行的脚本来查看是否添加了文件。因此,例如在我的问题中,它会是这样的:
with st.beta_expander("Upload DICOM Files"):
uploaded_files = st.file_uploader("Select DICOM Files:",
accept_multiple_files=True,
type='dcm')
有关st.beta_expander() 的更多信息以及可以用它做什么here。