-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
31 lines (23 loc) · 855 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Test streamlit with url parameters for x and y which can be specified in an iframe call
# Default url: http://localhost:8501/
# Try: http://localhost:8501/?x=10&y=20
import streamlit as st
def get_param(param_name):
query_params = st.experimental_get_query_params()
try:
return query_params[param_name][0]
except:
st.write('Parameters is missing')
return False
def get_params(params_names_list):
query_params = st.experimental_get_query_params()
responses = []
for parameter in params_names_list:
try:
responses.append(query_params[parameter][0])
except Exception as e:
responses.append(None)
return responses
x = st.number_input('X Parameter',value = float(get_param('x')))
y = st.number_input('Y Parameter',value = float(get_param('y')))
st.write(x+y)