St.warning("To use the Gallery, remove the image URL first.") St.warning("To use the Gallery, remove the uploaded image first.") If st.session_state.get("file_uploader"): # raise a warning if file uploader or URL downloader have already loaded an image Gallery_tab, upload_tab, url_tab = st.tabs() This is what the code will look like: # define three tabs for the three loading methods You can add pop-up warnings for the user when they load an image with a loader lower in the hierarchy and an image is already loaded with a loader higher in the hierarchy. For example, since you ordered the input modes as Gallery → File Uploader → Image URL, if you save the image into a variable img, anything loaded by the gallery will be overwritten by the file uploader and URL downloader outputs. You can make three different tabs using st.tabs() to switch between input modes:īecause of the way Streamlit runs the app (top-to-bottom), the input modes that come later will get higher priority and will overwrite the output of the previous loader.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |