mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-12-25 05:58:57 +00:00
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:
parent
fb4a417e53
commit
60cce4e579
@ -1,2 +1,2 @@
|
||||
streamlit==0.84.0
|
||||
streamlit>=0.84.0
|
||||
st-annotated-text==1.1.0
|
||||
|
||||
15
ui/webapp.py
15
ui/webapp.py
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user