Hi guys, i’m trying to caching an uploader file that works as input for all my tabs, but nothing works. if someone has an idea pls.
Here is my code:
fileEval = st.file_uploader(“Cargue un archivo”, type=[‘xlsm’])
@st.cache(allow_output_mutation=True)
def get_data():
fileEval
return fileEval
#fileEval = get_data()
st.markdown(
'<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">',
unsafe_allow_html=True,
)
query_params = st.experimental_get_query_params()
tabs = ["Datos", "Explainer", "Shap", "RaR", "Predicciones"]
if "tab" in query_params:
active_tab = query_params["tab"][0]
else:
active_tab = "Datos"
if active_tab not in tabs:
st.experimental_set_query_params(tab="Datos")
active_tab = "Datos"
li_items = "".join(
f"""
<li class="nav-item">
<a class="nav-link{' active' if t==active_tab else ''}" href="/?tab={t}">{t}</a>
</li>
"""
for t in tabs
)
tabs_html = f"""
<ul class="nav nav-tabs">
{li_items}
</ul>
"""
st.markdown(tabs_html, unsafe_allow_html=True)
st.markdown("<br>", unsafe_allow_html=True)
if active_tab == "Datos":
#fileEval = get_data()
# when 'Predict' is clicked, make the prediction and store it
#if st.button("Procesar"):
if fileEval:
dataRaw = fileInput(fileEval)
data = delAss(dataRaw)
dataI = delImp(dataRaw)
elif active_tab == "Explainer":
if fileEval:
dataRaw = fileInput(fileEval)
data = delAss(dataRaw)
dataI = delImp(dataRaw)
dataI['idpers'] = 'Cliente nuevo'
elif active_tab == "Shap":
if fileEval:
dataRaw = fileInput(fileEval)
data = delAss(dataRaw)
dataI = delImp(dataRaw)
dataI['idpers'] = 'Cliente nuevo'