Update app.py
Browse files
app.py
CHANGED
@@ -36,10 +36,10 @@ is_gpu_busy = False
|
|
36 |
def get_correct_qcs_image(srv, num_of_qubits, max_gates, g):
|
37 |
global is_gpu_busy
|
38 |
|
39 |
-
out_tensor = generate_srv_tensors(pipeline, f"Generate SRV: {srv}", samples=
|
40 |
qc_list, _, svr_list = convert_tensors_to_srvs(out_tensor, pipeline.gate_pool)
|
41 |
|
42 |
-
fig, axs = plt.subplots(
|
43 |
for qc,is_svr,ax in zip(qc_list, svr_list, axs.flatten()):
|
44 |
qc.draw("mpl", plot_barriers=False, ax=ax)
|
45 |
ax.set_title(f"{'Correct' if is_svr==srv else 'NOT correct'}, is SRV = {is_svr}")
|
@@ -60,10 +60,10 @@ Generating quantum circuits with diffusion models. Official demo of [[paper-arxi
|
|
60 |
col1, col2 = st.columns(2)
|
61 |
|
62 |
srv = col1.text_input('SRV', "[1,1,1,2,2]")
|
63 |
-
num_of_qubits =
|
64 |
max_gates = col1.select_slider('Max gates', options=[4,8,12,16,20,24,28], value=16)
|
65 |
g = col1.slider('Guidance scale', min_value=0.0, max_value=15.0, value=7.5)
|
66 |
|
67 |
-
if
|
68 |
image = get_correct_qcs_image(ast.literal_eval(srv), num_of_qubits, max_gates, g)
|
69 |
-
|
|
|
36 |
def get_correct_qcs_image(srv, num_of_qubits, max_gates, g):
|
37 |
global is_gpu_busy
|
38 |
|
39 |
+
out_tensor = generate_srv_tensors(pipeline, f"Generate SRV: {srv}", samples=8, system_size=num_of_qubits, num_of_qubits=num_of_qubits, max_gates=max_gates, g=g)
|
40 |
qc_list, _, svr_list = convert_tensors_to_srvs(out_tensor, pipeline.gate_pool)
|
41 |
|
42 |
+
fig, axs = plt.subplots(4, 2, figsize=(7,20), constrained_layout=True, dpi=120)
|
43 |
for qc,is_svr,ax in zip(qc_list, svr_list, axs.flatten()):
|
44 |
qc.draw("mpl", plot_barriers=False, ax=ax)
|
45 |
ax.set_title(f"{'Correct' if is_svr==srv else 'NOT correct'}, is SRV = {is_svr}")
|
|
|
60 |
col1, col2 = st.columns(2)
|
61 |
|
62 |
srv = col1.text_input('SRV', "[1,1,1,2,2]")
|
63 |
+
num_of_qubits = col1.radio('Number of qubits (should match SRV)', [3,4,5,6,7,8], index=2)
|
64 |
max_gates = col1.select_slider('Max gates', options=[4,8,12,16,20,24,28], value=16)
|
65 |
g = col1.slider('Guidance scale', min_value=0.0, max_value=15.0, value=7.5)
|
66 |
|
67 |
+
if col1.button('Generate circuits'):
|
68 |
image = get_correct_qcs_image(ast.literal_eval(srv), num_of_qubits, max_gates, g)
|
69 |
+
col2.image(image, use_column_width=False)
|