Update app.py
Browse files
app.py
CHANGED
@@ -48,7 +48,14 @@ def get_qcs(srv, num_of_qubits, max_gates, g):
|
|
48 |
|
49 |
st.write("Plotting...")
|
50 |
fig, axs = plt.subplots(3, 2, figsize=(7,10), constrained_layout=True, dpi=120)
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
for qc,is_svr,ax in zip(qc_list, svr_list, axs.flatten()):
|
|
|
52 |
qc.draw("mpl", plot_barriers=False, ax=ax)
|
53 |
ax.set_title(f"{'Correct' if is_svr==srv else 'NOT correct'}, is SRV = {is_svr}")
|
54 |
status.update(label="Generation complete!", state="complete", expanded=False)
|
@@ -63,25 +70,20 @@ def get_qcs(srv, num_of_qubits, max_gates, g):
|
|
63 |
# run
|
64 |
|
65 |
st.title("genQC · Generative Quantum Circuits")
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
st.subheader('Generating quantum circuits with diffusion models. Official demo of [[paper-arxiv]](https://arxiv.org/abs/2311.02041) [[code-repo]](https://github.com/FlorianFuerrutter/genQC).', divider=True)
|
70 |
-
# st.divider()
|
71 |
|
72 |
col1, col2 = st.columns(2)
|
73 |
|
74 |
srv = col1.text_input('SRV', "[1,1,1,2,2]")
|
75 |
num_of_qubits = col1.radio('Number of qubits (should match SRV)', [3,4,5,6,7,8], index=2)
|
|
|
|
|
76 |
|
77 |
srv_list = ast.literal_eval(srv)
|
78 |
if len(srv_list)!=num_of_qubits:
|
79 |
-
|
80 |
-
else:
|
81 |
-
col1.success(f'Number of qubits match with given SRV {srv_list}.', icon="✅")
|
82 |
-
|
83 |
-
max_gates = col1.select_slider('Max gates', options=[4,8,12,16,20,24,28], value=16)
|
84 |
-
g = col1.slider('Guidance scale', min_value=0.0, max_value=15.0, value=7.5)
|
85 |
|
86 |
if col1.button('Generate circuits'):
|
87 |
fig = get_qcs(srv_list, num_of_qubits, max_gates, g)
|
|
|
48 |
|
49 |
st.write("Plotting...")
|
50 |
fig, axs = plt.subplots(3, 2, figsize=(7,10), constrained_layout=True, dpi=120)
|
51 |
+
|
52 |
+
for ax in axs.flatten():
|
53 |
+
ax.axis('off')
|
54 |
+
ax.text(0.5, 0.5,"Circuit generated with errors")
|
55 |
+
|
56 |
+
|
57 |
for qc,is_svr,ax in zip(qc_list, svr_list, axs.flatten()):
|
58 |
+
ax.clear()
|
59 |
qc.draw("mpl", plot_barriers=False, ax=ax)
|
60 |
ax.set_title(f"{'Correct' if is_svr==srv else 'NOT correct'}, is SRV = {is_svr}")
|
61 |
status.update(label="Generation complete!", state="complete", expanded=False)
|
|
|
70 |
# run
|
71 |
|
72 |
st.title("genQC · Generative Quantum Circuits")
|
73 |
+
st.write("""
|
74 |
+
Generating quantum circuits with diffusion models. Official demo of [[paper-arxiv]](https://arxiv.org/abs/2311.02041) [[code-repo]](https://github.com/FlorianFuerrutter/genQC).
|
75 |
+
""")
|
|
|
|
|
76 |
|
77 |
col1, col2 = st.columns(2)
|
78 |
|
79 |
srv = col1.text_input('SRV', "[1,1,1,2,2]")
|
80 |
num_of_qubits = col1.radio('Number of qubits (should match SRV)', [3,4,5,6,7,8], index=2)
|
81 |
+
max_gates = col1.select_slider('Max gates', options=[4,8,12,16,20,24,28], value=16)
|
82 |
+
g = col1.slider('Guidance scale', min_value=0.0, max_value=15.0, value=7.5)
|
83 |
|
84 |
srv_list = ast.literal_eval(srv)
|
85 |
if len(srv_list)!=num_of_qubits:
|
86 |
+
st.warning(f'Number of qubits does not match with given SRV {srv_list}. This could result in error-circuits!', icon="⚠️")
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
if col1.button('Generate circuits'):
|
89 |
fig = get_qcs(srv_list, num_of_qubits, max_gates, g)
|