AEUPH/AGI-FORWARD
0
1import streamlit as st2from streamlit.components.v1 import html3 4# Directly access query parameters without a separate function5def main():6 # Access query parameters directly7 query_params = st.query_params8 9 # Check if 'param1' exists in the query parameters10 if 'param1' in query_params:11 # Extract the first value of 'param1'12 redirect_url = query_params['param1'][0]13 14 # Use JavaScript to redirect to the URL provided in 'param1'15 js = f"""16 <script>17 window.location.href = "{redirect_url}";18 </script>19 """20 html(js) # Use Streamlit's HTML component to run the JavaScript21 else:22 # If 'param1' is not present, display a message23 st.write("No redirect URL provided in query parameters.")24 25if __name__ == "__main__":26 main()27 