I have made separate functions for each page, but i want to change page to file upload when I click button on welcome_page.py. Found a switch_page function but I don't think I understand how it works.
import streamlit as st
from login import check_password
from file_upload import file_upload
from welcome import welcome_page
from PIL import Image
from numpy import asarray
from streamlit_extras.switch_page_button import switch_page
def file_upload():
datafile = st.file_uploader("Upload JPG",type=['jpg'])
if datafile is not None:
numpydata = asarray(datafile)
print(type(numpydata))
st.image(datafile)
return True
return False
if check_password():
if welcome_page():
switch_page('file_upload')
fileDetails = file_upload()
if fileDetails:
print("file uploaded")
Unfortunately, there isn't a built-in way to switch pages programmatically in a Streamlit multipage app. There is an open feature request here if you'd like to upvote it.