Spaces:
Sleeping
Sleeping
Commit
·
d30186e
1
Parent(s):
7d67389
update
Browse files
app.py
CHANGED
@@ -339,10 +339,7 @@ with gr.Blocks() as demo:
|
|
339 |
raw_fig.set_size_inches(5.6, 5.6)
|
340 |
raw_fig.savefig(filename, pad_inches=0)
|
341 |
|
342 |
-
|
343 |
-
#################################
|
344 |
-
#### determine the next step ####
|
345 |
-
#################################
|
346 |
|
347 |
in_num = len(channel_info["inputByIndex"])
|
348 |
matched_num = 30 - len(app_state["missingTemplates"])
|
@@ -407,19 +404,24 @@ with gr.Blocks() as demo:
|
|
407 |
|
408 |
name = app_state["missingTemplates"][0]
|
409 |
label = name+' (1/'+str(app_state["totalFillingNum"])+')'
|
|
|
410 |
if len(app_state["stage1UnassignedInputs"])==1 or app_state["totalFillingNum"]==1:
|
411 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
412 |
else:
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
step2_btn : gr.Button(btn_label, visible=True),
|
422 |
-
next_btn : gr.Button(visible=False)}
|
423 |
|
424 |
# step1 -> step3
|
425 |
elif app_state["state"] == "step3-initializing":
|
@@ -602,17 +604,25 @@ with gr.Blocks() as demo:
|
|
602 |
value = [channel_info["inputByIndex"][i] for i in value]
|
603 |
label = name+' (1/'+str(app_state["totalFillingNum"])+')'
|
604 |
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
611 |
|
612 |
fillmode_btn.click(
|
613 |
fn = fill_value,
|
614 |
inputs = [app_state_json, channel_info_json, in_fill_mode],
|
615 |
-
outputs = [app_state_json, in_fill_mode, fillmode_btn, chkbox_group, step3_btn, run_btn]
|
616 |
).success(
|
617 |
fn = None,
|
618 |
js = init_js,
|
@@ -635,6 +645,7 @@ with gr.Blocks() as demo:
|
|
635 |
# update the current round
|
636 |
app_state["fillingCount"] += 1
|
637 |
|
|
|
638 |
target_name = app_state["missingTemplates"][app_state["fillingCount"]-1]
|
639 |
target_idx = channel_info["templateByName"][target_name]["index"]
|
640 |
|
|
|
339 |
raw_fig.set_size_inches(5.6, 5.6)
|
340 |
raw_fig.savefig(filename, pad_inches=0)
|
341 |
|
342 |
+
# ------------------determine the next step-----------------------
|
|
|
|
|
|
|
343 |
|
344 |
in_num = len(channel_info["inputByIndex"])
|
345 |
matched_num = 30 - len(app_state["missingTemplates"])
|
|
|
404 |
|
405 |
name = app_state["missingTemplates"][0]
|
406 |
label = name+' (1/'+str(app_state["totalFillingNum"])+')'
|
407 |
+
|
408 |
if len(app_state["stage1UnassignedInputs"])==1 or app_state["totalFillingNum"]==1:
|
409 |
+
return {app_state_json : app_state,
|
410 |
+
channel_info_json : channel_info,
|
411 |
+
desc_md : gr.Markdown("### step2"),
|
412 |
+
tpl_montage : gr.Image(visible=False),
|
413 |
+
map_montage : gr.Image(visible=False),
|
414 |
+
radio : gr.Radio(choices=app_state["stage1UnassignedInputs"], value=[], label=label, visible=True),
|
415 |
+
next_btn : gr.Button("Next step")}
|
416 |
else:
|
417 |
+
return {app_state_json : app_state,
|
418 |
+
channel_info_json : channel_info,
|
419 |
+
desc_md : gr.Markdown("### step2"),
|
420 |
+
tpl_montage : gr.Image(visible=False),
|
421 |
+
map_montage : gr.Image(visible=False),
|
422 |
+
radio : gr.Radio(choices=app_state["stage1UnassignedInputs"], value=[], label=label, visible=True),
|
423 |
+
step2_btn : gr.Button(visible=True),
|
424 |
+
next_btn : gr.Button(visible=False)}
|
|
|
|
|
425 |
|
426 |
# step1 -> step3
|
427 |
elif app_state["state"] == "step3-initializing":
|
|
|
604 |
value = [channel_info["inputByIndex"][i] for i in value]
|
605 |
label = name+' (1/'+str(app_state["totalFillingNum"])+')'
|
606 |
|
607 |
+
if app_state["totalFillingNum"] == 1:
|
608 |
+
return {app_state_json : app_state,
|
609 |
+
in_fill_mode : gr.Dropdown(visible=False),
|
610 |
+
fillmode_btn : gr.Button(visible=False),
|
611 |
+
chkbox_group : gr.CheckboxGroup(choices=channel_info["inputByIndex"],
|
612 |
+
value=value, label=label, visible=True),
|
613 |
+
next_btn : gr.Button(visible=True)}
|
614 |
+
else:
|
615 |
+
return {app_state_json : app_state,
|
616 |
+
in_fill_mode : gr.Dropdown(visible=False),
|
617 |
+
fillmode_btn : gr.Button(visible=False),
|
618 |
+
chkbox_group : gr.CheckboxGroup(choices=channel_info["inputByIndex"],
|
619 |
+
value=value, label=label, visible=True),
|
620 |
+
step3_btn : gr.Button(visible=True)}
|
621 |
|
622 |
fillmode_btn.click(
|
623 |
fn = fill_value,
|
624 |
inputs = [app_state_json, channel_info_json, in_fill_mode],
|
625 |
+
outputs = [app_state_json, in_fill_mode, fillmode_btn, chkbox_group, step3_btn, next_btn, run_btn]
|
626 |
).success(
|
627 |
fn = None,
|
628 |
js = init_js,
|
|
|
645 |
# update the current round
|
646 |
app_state["fillingCount"] += 1
|
647 |
|
648 |
+
print('cntttttt:', app_state["fillingCount"])
|
649 |
target_name = app_state["missingTemplates"][app_state["fillingCount"]-1]
|
650 |
target_idx = channel_info["templateByName"][target_name]["index"]
|
651 |
|