I have my model ready but I want to use this to run on new image data. And I want to get the image by using upload option using streamlit. Is it possible to do that?
Hi, the following example might help for your use case. It’s a modification from: Upload Files to Streamlit App
import os import streamlit as st def file_selector(folder_path='.'): filenames = os.listdir(folder_path) selected_filename = st.selectbox('Select a file', filenames) return os.path.join(folder_path, selected_filename) if __name__ == '__main__': # Select a file if st.checkbox('Select a file in current directory'): folder_path = '.' if st.checkbox('Change directory'): folder_path = st.text_input('Enter folder path', '.') filename = file_selector(folder_path=folder_path) st.write('You selected `%s`' % filename) # TODO: Add code to open and process your image file
There’s actually a file uploader,
streamlit.file_uploader which returns a bytesio for binary uploads.