AGI-FORWARD / app.py
AEUPH's picture
Update app.py
b347104 verified
raw
history blame
838 Bytes
import streamlit as st
from streamlit.components.v1 import html
# Directly access query parameters without a separate function
def main():
# Access query parameters directly
query_params = st.query_params
# Check if 'param1' exists in the query parameters
if 'param1' in query_params:
# Extract the first value of 'param1'
redirect_url = query_params['param1'][0]
# Use JavaScript to redirect to the URL provided in 'param1'
js = f"""
<script>
window.location.href = "{redirect_url}";
</script>
"""
html(js) # Use Streamlit's HTML component to run the JavaScript
else:
# If 'param1' is not present, display a message
st.write("No redirect URL provided in query parameters.")
if __name__ == "__main__":
main()