Allow to upload multiple files simultaneously in Haystack UI (#1323)

* Fix only one file upload for Haystack UI

When using Haystack UI and streamlit, the default behavior is to upload one file at at time and override the file you have already uploaded. Streamlit now supports uploading multiple files and may be more intuitive for users of Haystack to use it as the default behavior.

Return type for `st.sidebar.file_uploader` when `accept_multiple_files=True` is a list of the files and empty if no files are provided

* Update requirements.txt

* Update requirements.txt

Co-authored-by: Malte Pietsch <malte.pietsch@deepset.ai>
This commit is contained in:
Markus Sagen 2021-08-06 17:45:36 +02:00 committed by GitHub
parent fb4a417e53
commit 60cce4e579
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -1,2 +1,2 @@
streamlit==0.84.0
streamlit>=0.84.0
st-annotated-text==1.1.0

View File

@ -65,14 +65,15 @@ eval_mode = st.sidebar.checkbox("Evaluation mode")
debug = st.sidebar.checkbox("Show debug info")
st.sidebar.write("## File Upload:")
data_file = st.sidebar.file_uploader("", type=["pdf", "txt", "docx"])
# Upload file
if data_file:
raw_json = upload_doc(data_file)
st.sidebar.write(raw_json)
if debug:
st.subheader("REST API JSON response")
data_files = st.sidebar.file_uploader("", type=["pdf", "txt", "docx"], accept_multiple_files=True)
for data_file in data_files:
# Upload file
if data_file:
raw_json = upload_doc(data_file)
st.sidebar.write(raw_json)
if debug:
st.subheader("REST API JSON response")
st.sidebar.write(raw_json)
# load csv into pandas dataframe
if eval_mode: