Spaces:
Runtime error
Runtime error
File size: 607 Bytes
09f2fb2 9323439 09f2fb2 9323439 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import streamlit as st
# Input fields
a = st.number_input("First value", 1, 1000)
b = st.number_input("Second value", 1, 1000)
# Perform an operation, and save its result
if st.button("Compute value"):
result = a * b
st.experimental_set_query_params(my_saved_result=result) # Save value
# Retrieve app state
app_state = st.experimental_get_query_params()
# Display saved result if it exist
if "my_saved_result" in app_state:
saved_result = app_state["my_saved_result"][0]
st.write("Here is your result", saved_result)
else:
st.write("No result to display, compute a value first.") |