awacke1 commited on
Commit
9f423cd
·
1 Parent(s): 17adc5f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -21
app.py CHANGED
@@ -7,39 +7,37 @@ from IPython.display import IFrame
7
 
8
  # query params exist
9
  try:
10
- options = ['cat', 'dog', 'mouse', 'bat', 'duck']
11
-
12
  query_params = st.experimental_get_query_params()
13
  query_option = query_params['option'][0] #throws an exception when visiting http://host:port
14
-
15
- option_selected = st.sidebar.selectbox('Pick option',
16
- options,
17
- index=options.index(query_option))
18
  if option_selected:
19
  st.experimental_set_query_params(option=option_selected)
 
20
 
21
  # run when query params don't exist. e.g on first launch
22
  except: # catch exception and set query param to predefined value
23
- options = ['cat', 'dog', 'mouse', 'bat', 'duck']
24
  st.experimental_set_query_params(option=options[1]) # defaults to dog
25
-
26
  query_params = st.experimental_get_query_params()
27
  query_option = query_params['option'][0]
28
-
29
- option_selected = st.sidebar.selectbox('Pick option',
30
- options,
31
- index=options.index(query_option))
32
  if option_selected:
33
  st.experimental_set_query_params(option=option_selected)
34
-
35
-
36
- src1='https://oreilly-qc.github.io?p=2-1'
37
- src2='https://javafxpert.github.io/grok-bloch/'
38
- src3='https://davidbkemp.github.io/quantum-gate-playground/'
39
- src4='https://algassert.com/quirk#circuit={%22cols%22:[[%22H%22],[%22Bloch%22],[%22Measure%22]]}'
40
-
41
- st.components.v1.iframe(src1, width=1200, height=800, scrolling=False)
42
-
 
 
 
 
 
43
 
44
  title = "AI Quantum - QGAN"
45
  description = "Using Superposition Advantage from Quantum for QGAN AI."
 
7
 
8
  # query params exist
9
  try:
10
+ options = ['Book', 'Grok', 'Playground', 'Circuit']
 
11
  query_params = st.experimental_get_query_params()
12
  query_option = query_params['option'][0] #throws an exception when visiting http://host:port
13
+ option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option))
 
 
 
14
  if option_selected:
15
  st.experimental_set_query_params(option=option_selected)
16
+ SetIframeURL(option_selected)
17
 
18
  # run when query params don't exist. e.g on first launch
19
  except: # catch exception and set query param to predefined value
20
+ options = ['Book', 'Grok', 'Playground', 'Circuit']
21
  st.experimental_set_query_params(option=options[1]) # defaults to dog
 
22
  query_params = st.experimental_get_query_params()
23
  query_option = query_params['option'][0]
24
+ option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option))
 
 
 
25
  if option_selected:
26
  st.experimental_set_query_params(option=option_selected)
27
+ SetIframeURL(option_selected)
28
+
29
+ def SetIframeURL(option_selected):
30
+ if (option_selected=='Book'):
31
+ src='https://oreilly-qc.github.io?p=2-1'
32
+ if (option_selected=='Grok'):
33
+ src='https://javafxpert.github.io/grok-bloch/'
34
+ if (option_selected=='Playground'):
35
+ src='https://davidbkemp.github.io/quantum-gate-playground/'
36
+ if (option_selected=='Circuit'):
37
+ src='https://algassert.com/quirk#circuit={%22cols%22:[[%22H%22],[%22Bloch%22],[%22Measure%22]]}'
38
+
39
+ # Render iframe contents
40
+ st.components.v1.iframe(src, width=1200, height=800, scrolling=False)
41
 
42
  title = "AI Quantum - QGAN"
43
  description = "Using Superposition Advantage from Quantum for QGAN AI."