{"id":15063782,"url":"https://github.com/hreikin/streamlit-uploads-library","last_synced_at":"2025-06-11T08:07:54.066Z","repository":{"id":124533095,"uuid":"610773614","full_name":"hreikin/streamlit-uploads-library","owner":"hreikin","description":"A simple uploads library and gallery for use in Streamlit projects.","archived":false,"fork":false,"pushed_at":"2023-04-01T13:18:43.000Z","size":22702,"stargazers_count":8,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T08:06:38.077Z","etag":null,"topics":["streamlit","streamlit-application","streamlit-gallery","streamlit-library","streamlit-uploads"],"latest_commit_sha":null,"homepage":"https://hreikin-streamlit-uploads-library-home-ar6h9h.streamlit.app/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hreikin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-03-07T13:05:08.000Z","updated_at":"2025-05-07T05:29:17.000Z","dependencies_parsed_at":"2023-07-26T13:11:34.526Z","dependency_job_id":null,"html_url":"https://github.com/hreikin/streamlit-uploads-library","commit_stats":null,"previous_names":["hreikin/streamlit-simple-gallery"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hreikin%2Fstreamlit-uploads-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hreikin%2Fstreamlit-uploads-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hreikin%2Fstreamlit-uploads-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hreikin%2Fstreamlit-uploads-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hreikin","download_url":"https://codeload.github.com/hreikin/streamlit-uploads-library/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hreikin%2Fstreamlit-uploads-library/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259227950,"owners_count":22824902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["streamlit","streamlit-application","streamlit-gallery","streamlit-library","streamlit-uploads"],"created_at":"2024-09-25T00:07:12.208Z","updated_at":"2025-06-11T08:07:54.028Z","avatar_url":"https://github.com/hreikin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Streamlit Uploads Library\n\n[![Open in Streamlit](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://hreikin-streamlit-uploads-library-home-ar6h9h.streamlit.app/)\n\nStreamlit Uploads Library is a simple, widget-based uploads library and gallery for use in \nStreamlit projects. Check out the demo using the Streamlit Cloud button above.\n\nThis package provides a simple wrapper around `st.file_uploader` with a save function included and \nalso provides library and gallery views for use in Streamlit projects. Using any of the views is \neasy, import `streamlit_uploads_library` and then instantiate the class with the required \n`directory` variable. Other options can be configured by passing in different variables when \ninstantiating the class. More information can be found in the Github repository.\n\n## Installation\n\nInstallation is available via pip:\n\n```\npip install streamlit-uploads-library\n```\n\n## Usage\n\nUsing any of the provided views is easy, import `streamlit_uploads_library` and then instantiate the class \nwith the required `directory` variable. Other options can be configured by passing in different variables \nwhen instantiating the class.\n\n### Library View\n\n- `directory` (required): A str() of the path to the folder containing the library images, for example, \"assets\".\n- `file_extensions` (optional): A tuple() containing strings of the file extensions to include in the library, default is (\".png\", \".jpg\", \".jpeg\").\n- `image_alignment` (optional): A str() with the CSS keyword used to align the images and details columns.\n- `number_of_columns` (optional): An int() defining the number of required columns, default is 5.\n- `show_details` (optional): A bool() to show or hide the file and edit details, False hides them, default is True to show them.\n- `uid` (optional): A str() containing a unique identifier allowing you to create multiple libraries on the same page containing the same images.\n\n```python\nimport streamlit as st\nfrom streamlit_uploads_library.library import Library\n\nst.set_page_config(page_title=\"Streamlit Uploads Library\", layout=\"wide\")\nlibrary = Library(directory=\"assets/landscape/\")\nlibrary_columns = Library(directory=\"assets/portrait/\", number_of_columns=4, uid=\"library-columns\")\nlibrary_mixed = Library(directory=\"assets/mixed/\", uid=\"mixed-library\")\n```\n\n### Gallery View\n\n- `directory` (required): A str() of the path to the folder containing the gallery images, for example, \"assets\".\n- `file_extensions` (optional): A tuple() containing strings of the file extensions to include in the gallery, default is (\".png\", \".jpg\", \".jpeg\").\n- `image_alignment` (optional): A str() with the CSS keyword used to align the images and details columns.\n- `number_of_columns` (optional): An int() defining the number of required columns, default is 5.\n- `show_details` (optional): A bool() to show or hide the file and edit details, True shows them, default is False to hide them and create a gallery.\n- `uid` (optional): A str() containing a unique identifier allowing you to create multiple galleries on the same page containing the same images.\n\n```python\nimport streamlit as st\nfrom streamlit_uploads_library.gallery import Gallery\n\nst.set_page_config(page_title=\"Streamlit Uploads Library\", layout=\"wide\")\ndefault_gallery = Gallery(directory=\"assets/landscape/\")\ncolumns_gallery = Gallery(directory=\"assets/portrait/\", number_of_columns=4, uid=\"gallery-columns\")\nmixed_gallery = Gallery(directory=\"assets/mixed/\", uid=\"mixed-gallery\")\n```\n\n### Upload View\n\nThe file uploader comes with multiple options able to be configured including 2 different view \ntypes. It is not required to use this and you can easily replace it with your own, it is provided \nas a convenience so you don't need to create the code yourself or replicate it across multiple \nprojects.\n\n- `save_location` (required): A str() of the path to the folder you wish to save images to, for example, \"assets\".\n- `expander` (optional): A bool() used to set the initial state of the expander, only used when using the \"expander\" widget_type.\n- `file_extensions` (optional): A list() containing strings of the file extensions to include in the library, default is (\".png\", \".jpg\", \".jpeg\").\n- `info_msg` (optional): A str() used to set an info message above the uploader, default is \"Upload new files here.\".\n- `header` (optional): A str() used to set the header of the \"expander\" or the header in the \"container\" type widget, default is \"Upload Files\", can be set to None to not display it.\n- `uid` (optional): A str() containing a unique identifier allowing you to create multiple file uploaders on the same page.\n- `upload_label` (optional): A str() used to set the label of the file uploader widget, default is \"Upload Files\", can be set to None to display an empty string instead.\n- `widget_type` (optional): A str() defining the type of widget to use to display the file uploader, options are \"container\" or \"expander\", default is \"container\".\n\n```python\nimport streamlit as st\nfrom streamlit_uploads_library.uploads import UploadFiles\n\nst.set_page_config(page_title=\"Streamlit Uploads Library\", layout=\"wide\")\ndefault_uploader = UploadFiles(save_location=\"assets\")\nexpander_uploader = UploadFiles(save_location=\"assets\", widget_type=\"expander\")\n```\n\n## Custom File Details\n\nA default set of basic file details is provided for each image within the library. Using class \ninheritance this can be overridden to create your own file details section if you wish to include \nmore information or different options.\n\n```python\nimport streamlit as st\nfrom streamlit_uploads_library.library import Library\n\nclass CustomLibrary(Library):\n    def __init__(self, directory, file_extensions=(\".png\", \".jpg\", \".jpeg\"), image_alignment=\"end\", number_of_columns=5, show_details=True, uid=\"custom\"):\n        self.directory = directory\n        self.file_extensions = file_extensions\n        self.image_alignment = image_alignment\n        self.number_of_columns = number_of_columns\n        self.show_details = show_details\n        self.uid = uid\n        super(CustomLibrary, self).__init__(self.directory, self.file_extensions, self.image_alignment, self.number_of_columns, self.show_details, self.uid)\n\n    def create_details(_self, img, filename_idx, uid):\n        # Your details section code here\n```\n\n## Caching\n\nStreamlit Uploads Library makes use of the `st.cache_resource` decorator so the library and gallery \nwill load from the cache instead of reloading the images each time the app is run. You will \nprobably want to clear your cache after uploading new files to your app, the file uploader view \nprovided by this package takes care of that for you but if you use your own file uploader and save \nfunction then to clear the cache you can use the `st.cache_resource.clear()` function provided by \nStreamlit.\n\n## Example App (Demo)\n\nTo run the example application provided in the repository:\n\n```bash\ngit clone https://github.com/hreikin/streamlit-uploads-library\ncd streamlit-uploads-library/\npython -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\nstreamlit run Home.py\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhreikin%2Fstreamlit-uploads-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhreikin%2Fstreamlit-uploads-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhreikin%2Fstreamlit-uploads-library/lists"}