Its in the dev branch but I reckon you will want to wait for the next official release, these appear to happen monthly so expect this will be slightly before or after xmas
Hey @jamesschrott.
- It’s in the
develop
branch as Rob mentioned. - You can see the timeline for our previous releases here https://github.com/streamlit/streamlit/releases or https://pypi.org/project/streamlit/#history
- You can have a look at the docstring for the widget here https://github.com/streamlit/streamlit/blob/develop/lib/streamlit/DeltaGenerator.py#L1927
Thanks for your replies. The docs describe exactly what I need and I’m looking forward to the next release.
Great work!
Fantastic! I’ve been patiently waiting for this feature!
EGM
Hey all,
Quick update that the file-uploader feature has officially been released on 0.52.0. One Note, this is a preview release for the feature. Hope everyone gets a chance to play with it and feel free to let us know what you think!
@karl @Salim @Adam_Hackbarth @qxlsz @Marc @zzhangjw @asghar3166 @neomatrix369 @robmarkcole @jamesschrott @gabe_maldonado
Good job with the file uploader. I spent some time playing with it but could not figure out how to upload multiple files.
In my case I would like the user to upload multiple images (in a batch or one-by-one), and then run an ML model on them. Is this possible with the current release?
I have created an issue on github related to uploading images
@tc1 I created an app using the new file upload feature, it allows uploading an image and running object detection on it, as well as adjusting the confidence threshold. As an experiment I developed it using a devcontainer and deployed via docker, and it is working rather nicely. Link below.
Cheers
Hey @robmarkcole, this looks awesome, thanks for sharing it! Not going to have a ton of service this week [out of town for the holidays], but definitely excited to play around with it more next week.
@amineHY, thanks for posting the question and hopefully Robin’s response in the GitHub issue helped [thanks for the assist Robin].
@ifeherva, good question, would you mind asking this in a separate new forum topic?
Also, happy holidays to everyone if you’re celebrating and hope everyone is doing well
Hi @tc1,
Yes @robmarkcole workaround does the job for an image.
Sorry, I wasn’t specific in the description, my concern is for processing video frames.
I usually use OpenCV to read the frames and process them, but I am unable to do that using PIL for now. Any help is more than welcome.
Thank you in advance.
Hi!
I have updated Adrien’s code to make it work with recursive subdirectories.
import os
import streamlit as st
def st_file_selector(st_placeholder, path='.', label='Please, select a file/folder...'):
# get base path (directory)
base_path = '.' if path is None or path is '' else path
base_path = base_path if os.path.isdir(
base_path) else os.path.dirname(base_path)
base_path = '.' if base_path is None or base_path is '' else base_path
# list files in base path directory
files = os.listdir(base_path)
if base_path is not '.':
files.insert(0, '..')
files.insert(0, '.')
selected_file = st_placeholder.selectbox(
label=label, options=files, key=base_path)
selected_path = os.path.normpath(os.path.join(base_path, selected_file))
if selected_file is '.':
return selected_path
if os.path.isdir(selected_path):
selected_path = st_file_selector(st_placeholder=st_placeholder,
path=selected_path, label=label)
return selected_path
It uses the following code to handle the persistence of session states:
The st_file_selector
function can be invoked in the following way:
st_session_state = get(input_path='.')
st_session_state.input_path = st_file_selector(st_placeholder=st.empty(), path=st_session_state.input_path, label=f'Input path')
st.text(f'> Selected \'{st_session_state.input_path}\'.')
Hope it helps.
Cheers,
Mark
Here is an App implementing the drop/ upload image: https://github.com/amineHY/WebApp-Computer-Vision-streamlit
Feel free to fork/contribute.
Any pointers?
Hi Marc,
Thank you for introducing me to Droopy. I was able to make it work by itself, but can you show me how to embed the Droopy file uploader widget into a Streamlit app?
namong
Hi @namong
I don’t think you should be using droopy now that the file uploader is available in Streamlit. Does it not work for you?
Thank you for your quick response, Marc. Much appreciated!
I missed that new feature, it works perfectly.
-namong
Is there anyway to get the file name or file suffix from the extension, I’m using filemagic, but it’s weird
Not as far as I know.
Hi Adrien, I created a .html file by folium displaying a heatmap. I want to display the .html in a small window within my streamlit app. Or open the .html file in another tab with a clickable button
I have a situation like this. I need to load data from my local. (set of pdf files) When I am giving a path inside my local both for input and output it should read the data. in the local host streamlit I am able to achieve it but when I deployed using heroku-github its not happening.
I need to develop this app in a feasible way. What do you suggest?