Open enrico-stauss opened 1 week ago
Hi,
I'm using this component to browse a set of files that are created by the running application. Unfortunately I noticed, that freshly created files do not show up immediately when nagivating the file browser. I also do not now how to trigger a rebuild of the file tree. Sometimes they just show up after a bit.
I already made sure that the caching option is set to False and from looking into the python backend in init.py, I cannot directly understand why freshly added files are not picked up. I'm not using any of {
use_static_file_server
,artifacts_site
, orartifacts_download_site
}.Can you help me out with this?
Thank you and kind regards!
Hi,
In our scenario, we used a streamlit component named streamlit_autorefresh
(from streamlit_autorefresh import st_autorefresh) to refresh:
Can you see if this way can satisfy your demand?
I gave it a try but unfortunately it is not satisfactory. My usecase for your component is quite simple though, I like the idea and the fact that it is plug-and-play but I may just revert to implementing the functionality directly in streamlit myself.
I gave it a try but unfortunately it is not satisfactory. My usecase for your component is quite simple though, I like the idea and the fact that it is plug-and-play but I may just revert to implementing the functionality directly in streamlit myself.
Ok~ Otherwise, Could you provide me with a simple code example to illustrate your scenario? I might consider a way to support it in my leisure time.
I can provide you with a brief MWE for it:
import os
import streamlit as st
from streamlit_file_browser import st_file_browser
BASE_DIRECTORY = "tmp_dir"
os.makedirs(BASE_DIRECTORY, exist_ok=True)
left, right = st.columns(2)
with left, st.form("file_input", clear_on_submit=True):
file_name = st.text_input("file name")
file_content = st.text_area("file content")
submitted = st.form_submit_button("Create")
if submitted:
with open(os.path.join(BASE_DIRECTORY, file_name), "x") as fp:
fp.write(file_content)
with right:
st_file_browser(
BASE_DIRECTORY,
key="test",
show_choose_file=False,
show_delete_file=False,
use_static_file_server=False,
show_download_file=True,
show_new_folder=False,
show_upload_file=False,
show_preview=True,
use_cache=False,
)
Kind regards Enrico
Hi,
I'm using this component to browse a set of files that are created by the running application. Unfortunately I noticed, that freshly created files do not show up immediately when nagivating the file browser. I also do not now how to trigger a rebuild of the file tree. Sometimes they just show up after a bit.
I already made sure that the caching option is set to False and from looking into the python backend in init.py, I cannot directly understand why freshly added files are not picked up. I'm not using any of {
use_static_file_server
,artifacts_site
, orartifacts_download_site
}.Can you help me out with this?
Thank you and kind regards!