Spaces:
Sleeping
Sleeping
Commit
·
64d9ce3
1
Parent(s):
0f679e8
update
Browse files
app.py
CHANGED
@@ -213,9 +213,9 @@ update_js = """
|
|
213 |
"""
|
214 |
|
215 |
with gr.Blocks() as demo:
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
|
220 |
gr.Markdown(intro)
|
221 |
with gr.Row():
|
@@ -329,9 +329,9 @@ with gr.Blocks() as demo:
|
|
329 |
}
|
330 |
stage2_info = None
|
331 |
channel_info = None
|
332 |
-
return {
|
333 |
-
|
334 |
-
|
335 |
# --------------------Stage1-------------------------
|
336 |
map_btn : gr.Button(interactive=False),
|
337 |
desc_md : gr.Markdown("", visible=False),
|
@@ -387,8 +387,8 @@ with gr.Blocks() as demo:
|
|
387 |
- channels highlighted in red are those that do not match any template channels.
|
388 |
"""
|
389 |
stage1_info["state"] = "step1-finished"
|
390 |
-
yield {
|
391 |
-
|
392 |
map_btn : gr.Button(interactive=True),
|
393 |
desc_md : gr.Markdown(md),
|
394 |
tpl_img : gr.Image(visible=True),
|
@@ -413,8 +413,8 @@ with gr.Blocks() as demo:
|
|
413 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
414 |
|
415 |
stage1_info["state"] = "finished"
|
416 |
-
yield {
|
417 |
-
|
418 |
desc_md : gr.Markdown(md),
|
419 |
tpl_img : gr.Image(visible=False),
|
420 |
mapped_img : gr.Image(visible=False),
|
@@ -440,14 +440,14 @@ with gr.Blocks() as demo:
|
|
440 |
stage1_info["state"] = "step2-selecting"
|
441 |
# determine which button to display
|
442 |
if stage1_info["totalFillingNum"] == 1:
|
443 |
-
yield {
|
444 |
desc_md : gr.Markdown(md),
|
445 |
tpl_img : gr.Image(visible=False),
|
446 |
mapped_img : gr.Image(visible=False),
|
447 |
radio_group : gr.Radio(choices=stage1_info["unassignedInputs"], value=[], label=label, visible=True),
|
448 |
clear_btn : gr.Button(visible=True)}
|
449 |
else:
|
450 |
-
yield {
|
451 |
desc_md : gr.Markdown(md),
|
452 |
tpl_img : gr.Image(visible=False),
|
453 |
mapped_img : gr.Image(visible=False),
|
@@ -464,7 +464,7 @@ with gr.Blocks() as demo:
|
|
464 |
Select one of the methods provided below to fill the remaining template channels.
|
465 |
"""
|
466 |
stage1_info["state"] = "step3-select-method"
|
467 |
-
yield {
|
468 |
desc_md : gr.Markdown(md),
|
469 |
tpl_img : gr.Image(visible=False),
|
470 |
mapped_img : gr.Image(visible=False),
|
@@ -509,8 +509,8 @@ with gr.Blocks() as demo:
|
|
509 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
510 |
|
511 |
stage1_info["state"] = "finished"
|
512 |
-
yield {
|
513 |
-
|
514 |
desc_md : gr.Markdown(md),
|
515 |
radio_group : gr.Radio(visible=False),
|
516 |
out_json_file : gr.File(filename, visible=True),
|
@@ -523,8 +523,8 @@ with gr.Blocks() as demo:
|
|
523 |
Select one of the methods provided below to fill the remaining template channels.
|
524 |
"""
|
525 |
stage1_info["state"] = "step3-select-method"
|
526 |
-
yield {
|
527 |
-
|
528 |
desc_md : gr.Markdown(md),
|
529 |
radio_group : gr.Radio(visible=False),
|
530 |
in_fillmode : gr.Dropdown(visible=True),
|
@@ -547,8 +547,8 @@ with gr.Blocks() as demo:
|
|
547 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
548 |
|
549 |
stage1_info["state"] = "finished"
|
550 |
-
yield {
|
551 |
-
|
552 |
desc_md : gr.Markdown(md),
|
553 |
in_fillmode : gr.Dropdown(visible=False),
|
554 |
fillmode_btn : gr.Button(visible=False),
|
@@ -580,7 +580,7 @@ with gr.Blocks() as demo:
|
|
580 |
stage1_info["state"] = "step3-2-selecting"
|
581 |
# determine which button to display
|
582 |
if stage1_info["totalFillingNum"] == 1:
|
583 |
-
yield {
|
584 |
desc_md : gr.Markdown(md),
|
585 |
in_fillmode : gr.Dropdown(visible=False),
|
586 |
fillmode_btn : gr.Button(visible=False),
|
@@ -588,7 +588,7 @@ with gr.Blocks() as demo:
|
|
588 |
value=chkbox_value, label=chkbox_label, visible=True),
|
589 |
next_btn : gr.Button(visible=True)}
|
590 |
else:
|
591 |
-
yield {
|
592 |
desc_md : gr.Markdown(md),
|
593 |
in_fillmode : gr.Dropdown(visible=False),
|
594 |
fillmode_btn : gr.Button(visible=False),
|
@@ -617,8 +617,8 @@ with gr.Blocks() as demo:
|
|
617 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
618 |
|
619 |
stage1_info["state"] = "finished"
|
620 |
-
yield {
|
621 |
-
|
622 |
desc_md : gr.Markdown(md),
|
623 |
chkbox_group : gr.CheckboxGroup(visible=False),
|
624 |
next_btn : gr.Button(visible=False),
|
@@ -626,13 +626,13 @@ with gr.Blocks() as demo:
|
|
626 |
|
627 |
next_btn.click(
|
628 |
fn = init_next_step,
|
629 |
-
inputs = [
|
630 |
-
outputs = [
|
631 |
in_fillmode, fillmode_btn, chkbox_group, step3_btn, out_json_file, next_btn]
|
632 |
).success(
|
633 |
fn = None,
|
634 |
js = init_js,
|
635 |
-
inputs = [
|
636 |
outputs = []
|
637 |
)
|
638 |
|
@@ -642,14 +642,14 @@ with gr.Blocks() as demo:
|
|
642 |
# +========================================================================================+
|
643 |
map_btn.click(
|
644 |
fn = reset_all,
|
645 |
-
inputs = [
|
646 |
-
outputs = [
|
647 |
radio_group, clear_btn, step2_btn, in_fillmode, fillmode_btn, chkbox_group, step3_btn,
|
648 |
out_json_file, in_data_file, in_samplerate, run_btn, cancel_btn, batch_md, out_data_file]
|
649 |
).success(
|
650 |
fn = init_next_step,
|
651 |
-
inputs = [
|
652 |
-
outputs = [
|
653 |
)
|
654 |
|
655 |
|
@@ -657,7 +657,7 @@ with gr.Blocks() as demo:
|
|
657 |
# | Stage1-step2 |
|
658 |
# +========================================================================================+
|
659 |
# determine which button to display based on the current state
|
660 |
-
@radio_group.select(inputs =
|
661 |
def determine_button(stage1_info):
|
662 |
if len(stage1_info["unassignedInputs"]) == 1:
|
663 |
return {step2_btn : gr.Button(visible=False),
|
@@ -665,7 +665,7 @@ with gr.Blocks() as demo:
|
|
665 |
else:
|
666 |
return {step2_btn : gr.Button()} # change nothing
|
667 |
# clear the selected value and reset the buttons
|
668 |
-
@clear_btn.click(inputs =
|
669 |
def clear_value(stage1_info):
|
670 |
if len(stage1_info["unassignedInputs"])==1 and stage1_info["fillingCount"]<stage1_info["totalFillingNum"]:
|
671 |
return {radio_group : gr.Radio(value=[]),
|
@@ -699,26 +699,26 @@ with gr.Blocks() as demo:
|
|
699 |
|
700 |
# determine which button to display
|
701 |
if stage1_info["fillingCount"] == stage1_info["totalFillingNum"]:
|
702 |
-
return {
|
703 |
-
|
704 |
radio_group : gr.Radio(choices=stage1_info["unassignedInputs"],
|
705 |
value=[], label=radio_label),
|
706 |
step2_btn : gr.Button(visible=False),
|
707 |
next_btn : gr.Button(visible=True)}
|
708 |
else:
|
709 |
-
return {
|
710 |
-
|
711 |
radio_group : gr.Radio(choices=stage1_info["unassignedInputs"],
|
712 |
value=[], label=radio_label)}
|
713 |
|
714 |
step2_btn.click(
|
715 |
fn = update_radio,
|
716 |
-
inputs = [
|
717 |
-
outputs = [
|
718 |
).success(
|
719 |
fn = None,
|
720 |
js = update_js,
|
721 |
-
inputs = [
|
722 |
outputs = []
|
723 |
)
|
724 |
|
@@ -746,34 +746,34 @@ with gr.Blocks() as demo:
|
|
746 |
|
747 |
# determine which button to display
|
748 |
if stage1_info["fillingCount"] == stage1_info["totalFillingNum"]:
|
749 |
-
return {
|
750 |
chkbox_group : gr.CheckboxGroup(value=chkbox_value, label=chkbox_label),
|
751 |
step3_btn : gr.Button(visible=False),
|
752 |
next_btn : gr.Button(visible=True)}
|
753 |
else:
|
754 |
-
return {
|
755 |
chkbox_group : gr.CheckboxGroup(value=chkbox_value, label=chkbox_label)}
|
756 |
|
757 |
fillmode_btn.click(
|
758 |
fn = init_next_step,
|
759 |
-
inputs = [
|
760 |
-
outputs = [
|
761 |
out_json_file, next_btn]
|
762 |
).success(
|
763 |
fn = None,
|
764 |
js = init_js,
|
765 |
-
inputs = [
|
766 |
outputs = []
|
767 |
)
|
768 |
|
769 |
step3_btn.click(
|
770 |
fn = update_chkbox,
|
771 |
-
inputs = [
|
772 |
-
outputs = [
|
773 |
).success(
|
774 |
fn = None,
|
775 |
js = update_js,
|
776 |
-
inputs = [
|
777 |
outputs = []
|
778 |
)
|
779 |
|
@@ -783,14 +783,14 @@ with gr.Blocks() as demo:
|
|
783 |
# +========================================================================================+
|
784 |
# verify that all required inputs have been provided
|
785 |
@gr.on(triggers = [in_data_file.upload, in_data_file.clear, in_samplerate.change, out_json_file.change],
|
786 |
-
inputs = [
|
787 |
def check_input(stage1_info, in_data, samplerate):
|
788 |
if stage1_info["state"]=="finished" and in_data!=None and samplerate!="":
|
789 |
return gr.Button(interactive=True)
|
790 |
else:
|
791 |
return gr.Button(interactive=False)
|
792 |
|
793 |
-
@cancel_btn.click(inputs =
|
794 |
def stop_processing(stage2_info):
|
795 |
utils.dataDelete(stage2_info["filePath"])
|
796 |
stage2_info["state"] = "interrupted"
|
@@ -819,7 +819,7 @@ with gr.Blocks() as demo:
|
|
819 |
"state" : "running",
|
820 |
"sampleRate" : int(samplerate)
|
821 |
}
|
822 |
-
return {
|
823 |
run_btn : gr.Button(visible=False),
|
824 |
cancel_btn : gr.Button(visible=True, interactive=True),
|
825 |
batch_md : gr.Markdown("", visible=True),
|
@@ -874,7 +874,7 @@ with gr.Blocks() as demo:
|
|
874 |
cancel_btn : gr.Button(visible=False)}
|
875 |
else:
|
876 |
stage2_info["state"] = "finished"
|
877 |
-
yield {
|
878 |
run_btn : gr.Button(visible=True),
|
879 |
cancel_btn : gr.Button(visible=False),
|
880 |
batch_md : gr.Markdown(visible=False),
|
@@ -883,11 +883,11 @@ with gr.Blocks() as demo:
|
|
883 |
run_btn.click(
|
884 |
fn = reset_run,
|
885 |
inputs = [in_data_file, in_samplerate, in_modelname],
|
886 |
-
outputs = [
|
887 |
).success(
|
888 |
fn = run_model,
|
889 |
-
inputs = [
|
890 |
-
outputs = [
|
891 |
)
|
892 |
|
893 |
if __name__ == "__main__":
|
|
|
213 |
"""
|
214 |
|
215 |
with gr.Blocks() as demo:
|
216 |
+
stage1_json = gr.JSON(visible=False)
|
217 |
+
stage2_json = gr.JSON(visible=False)
|
218 |
+
channel_json = gr.JSON(visible=False)
|
219 |
|
220 |
gr.Markdown(intro)
|
221 |
with gr.Row():
|
|
|
329 |
}
|
330 |
stage2_info = None
|
331 |
channel_info = None
|
332 |
+
return {stage1_json : stage1_info,
|
333 |
+
stage2_json : stage2_info,
|
334 |
+
channel_json : channel_info,
|
335 |
# --------------------Stage1-------------------------
|
336 |
map_btn : gr.Button(interactive=False),
|
337 |
desc_md : gr.Markdown("", visible=False),
|
|
|
387 |
- channels highlighted in red are those that do not match any template channels.
|
388 |
"""
|
389 |
stage1_info["state"] = "step1-finished"
|
390 |
+
yield {stage1_json : stage1_info,
|
391 |
+
channel_json : channel_info,
|
392 |
map_btn : gr.Button(interactive=True),
|
393 |
desc_md : gr.Markdown(md),
|
394 |
tpl_img : gr.Image(visible=True),
|
|
|
413 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
414 |
|
415 |
stage1_info["state"] = "finished"
|
416 |
+
yield {stage1_json : stage1_info,
|
417 |
+
channel_json : channel_info,
|
418 |
desc_md : gr.Markdown(md),
|
419 |
tpl_img : gr.Image(visible=False),
|
420 |
mapped_img : gr.Image(visible=False),
|
|
|
440 |
stage1_info["state"] = "step2-selecting"
|
441 |
# determine which button to display
|
442 |
if stage1_info["totalFillingNum"] == 1:
|
443 |
+
yield {stage1_json : stage1_info,
|
444 |
desc_md : gr.Markdown(md),
|
445 |
tpl_img : gr.Image(visible=False),
|
446 |
mapped_img : gr.Image(visible=False),
|
447 |
radio_group : gr.Radio(choices=stage1_info["unassignedInputs"], value=[], label=label, visible=True),
|
448 |
clear_btn : gr.Button(visible=True)}
|
449 |
else:
|
450 |
+
yield {stage1_json : stage1_info,
|
451 |
desc_md : gr.Markdown(md),
|
452 |
tpl_img : gr.Image(visible=False),
|
453 |
mapped_img : gr.Image(visible=False),
|
|
|
464 |
Select one of the methods provided below to fill the remaining template channels.
|
465 |
"""
|
466 |
stage1_info["state"] = "step3-select-method"
|
467 |
+
yield {stage1_json : stage1_info,
|
468 |
desc_md : gr.Markdown(md),
|
469 |
tpl_img : gr.Image(visible=False),
|
470 |
mapped_img : gr.Image(visible=False),
|
|
|
509 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
510 |
|
511 |
stage1_info["state"] = "finished"
|
512 |
+
yield {stage1_json : stage1_info,
|
513 |
+
channel_json : channel_info,
|
514 |
desc_md : gr.Markdown(md),
|
515 |
radio_group : gr.Radio(visible=False),
|
516 |
out_json_file : gr.File(filename, visible=True),
|
|
|
523 |
Select one of the methods provided below to fill the remaining template channels.
|
524 |
"""
|
525 |
stage1_info["state"] = "step3-select-method"
|
526 |
+
yield {stage1_json : stage1_info,
|
527 |
+
channel_json : channel_info,
|
528 |
desc_md : gr.Markdown(md),
|
529 |
radio_group : gr.Radio(visible=False),
|
530 |
in_fillmode : gr.Dropdown(visible=True),
|
|
|
547 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
548 |
|
549 |
stage1_info["state"] = "finished"
|
550 |
+
yield {stage1_json : stage1_info,
|
551 |
+
channel_json : channel_info,
|
552 |
desc_md : gr.Markdown(md),
|
553 |
in_fillmode : gr.Dropdown(visible=False),
|
554 |
fillmode_btn : gr.Button(visible=False),
|
|
|
580 |
stage1_info["state"] = "step3-2-selecting"
|
581 |
# determine which button to display
|
582 |
if stage1_info["totalFillingNum"] == 1:
|
583 |
+
yield {stage1_json : stage1_info,
|
584 |
desc_md : gr.Markdown(md),
|
585 |
in_fillmode : gr.Dropdown(visible=False),
|
586 |
fillmode_btn : gr.Button(visible=False),
|
|
|
588 |
value=chkbox_value, label=chkbox_label, visible=True),
|
589 |
next_btn : gr.Button(visible=True)}
|
590 |
else:
|
591 |
+
yield {stage1_json : stage1_info,
|
592 |
desc_md : gr.Markdown(md),
|
593 |
in_fillmode : gr.Dropdown(visible=False),
|
594 |
fillmode_btn : gr.Button(visible=False),
|
|
|
617 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
618 |
|
619 |
stage1_info["state"] = "finished"
|
620 |
+
yield {stage1_json : stage1_info,
|
621 |
+
channel_json : channel_info,
|
622 |
desc_md : gr.Markdown(md),
|
623 |
chkbox_group : gr.CheckboxGroup(visible=False),
|
624 |
next_btn : gr.Button(visible=False),
|
|
|
626 |
|
627 |
next_btn.click(
|
628 |
fn = init_next_step,
|
629 |
+
inputs = [stage1_json, channel_json, in_fillmode, radio_group, chkbox_group],
|
630 |
+
outputs = [stage1_json, channel_json, desc_md, tpl_img, mapped_img, radio_group, clear_btn, step2_btn,
|
631 |
in_fillmode, fillmode_btn, chkbox_group, step3_btn, out_json_file, next_btn]
|
632 |
).success(
|
633 |
fn = None,
|
634 |
js = init_js,
|
635 |
+
inputs = [stage1_json, channel_json],
|
636 |
outputs = []
|
637 |
)
|
638 |
|
|
|
642 |
# +========================================================================================+
|
643 |
map_btn.click(
|
644 |
fn = reset_all,
|
645 |
+
inputs = [stage1_json, stage2_json, in_loc_file],
|
646 |
+
outputs = [stage1_json, stage2_json, channel_json, map_btn, desc_md, next_btn, tpl_img, mapped_img,
|
647 |
radio_group, clear_btn, step2_btn, in_fillmode, fillmode_btn, chkbox_group, step3_btn,
|
648 |
out_json_file, in_data_file, in_samplerate, run_btn, cancel_btn, batch_md, out_data_file]
|
649 |
).success(
|
650 |
fn = init_next_step,
|
651 |
+
inputs = [stage1_json, channel_json, in_fillmode, radio_group, chkbox_group],
|
652 |
+
outputs = [stage1_json, channel_json, map_btn, desc_md, tpl_img, mapped_img, next_btn]
|
653 |
)
|
654 |
|
655 |
|
|
|
657 |
# | Stage1-step2 |
|
658 |
# +========================================================================================+
|
659 |
# determine which button to display based on the current state
|
660 |
+
@radio_group.select(inputs = stage1_json, outputs = [step2_btn, next_btn])
|
661 |
def determine_button(stage1_info):
|
662 |
if len(stage1_info["unassignedInputs"]) == 1:
|
663 |
return {step2_btn : gr.Button(visible=False),
|
|
|
665 |
else:
|
666 |
return {step2_btn : gr.Button()} # change nothing
|
667 |
# clear the selected value and reset the buttons
|
668 |
+
@clear_btn.click(inputs = stage1_json, outputs = [radio_group, step2_btn, next_btn])
|
669 |
def clear_value(stage1_info):
|
670 |
if len(stage1_info["unassignedInputs"])==1 and stage1_info["fillingCount"]<stage1_info["totalFillingNum"]:
|
671 |
return {radio_group : gr.Radio(value=[]),
|
|
|
699 |
|
700 |
# determine which button to display
|
701 |
if stage1_info["fillingCount"] == stage1_info["totalFillingNum"]:
|
702 |
+
return {stage1_json : stage1_info,
|
703 |
+
channel_json : channel_info,
|
704 |
radio_group : gr.Radio(choices=stage1_info["unassignedInputs"],
|
705 |
value=[], label=radio_label),
|
706 |
step2_btn : gr.Button(visible=False),
|
707 |
next_btn : gr.Button(visible=True)}
|
708 |
else:
|
709 |
+
return {stage1_json : stage1_info,
|
710 |
+
channel_json : channel_info,
|
711 |
radio_group : gr.Radio(choices=stage1_info["unassignedInputs"],
|
712 |
value=[], label=radio_label)}
|
713 |
|
714 |
step2_btn.click(
|
715 |
fn = update_radio,
|
716 |
+
inputs = [stage1_json, channel_json, radio_group],
|
717 |
+
outputs = [stage1_json, channel_json, radio_group, step2_btn, next_btn]
|
718 |
).success(
|
719 |
fn = None,
|
720 |
js = update_js,
|
721 |
+
inputs = [stage1_json, channel_json],
|
722 |
outputs = []
|
723 |
)
|
724 |
|
|
|
746 |
|
747 |
# determine which button to display
|
748 |
if stage1_info["fillingCount"] == stage1_info["totalFillingNum"]:
|
749 |
+
return {stage1_json : stage1_info,
|
750 |
chkbox_group : gr.CheckboxGroup(value=chkbox_value, label=chkbox_label),
|
751 |
step3_btn : gr.Button(visible=False),
|
752 |
next_btn : gr.Button(visible=True)}
|
753 |
else:
|
754 |
+
return {stage1_json : stage1_info,
|
755 |
chkbox_group : gr.CheckboxGroup(value=chkbox_value, label=chkbox_label)}
|
756 |
|
757 |
fillmode_btn.click(
|
758 |
fn = init_next_step,
|
759 |
+
inputs = [stage1_json, channel_json, in_fillmode, radio_group, chkbox_group],
|
760 |
+
outputs = [stage1_json, channel_json, desc_md, in_fillmode, fillmode_btn, chkbox_group, step3_btn,
|
761 |
out_json_file, next_btn]
|
762 |
).success(
|
763 |
fn = None,
|
764 |
js = init_js,
|
765 |
+
inputs = [stage1_json, channel_json],
|
766 |
outputs = []
|
767 |
)
|
768 |
|
769 |
step3_btn.click(
|
770 |
fn = update_chkbox,
|
771 |
+
inputs = [stage1_json, channel_json, chkbox_group],
|
772 |
+
outputs = [stage1_json, chkbox_group, step3_btn, next_btn]
|
773 |
).success(
|
774 |
fn = None,
|
775 |
js = update_js,
|
776 |
+
inputs = [stage1_json, channel_json],
|
777 |
outputs = []
|
778 |
)
|
779 |
|
|
|
783 |
# +========================================================================================+
|
784 |
# verify that all required inputs have been provided
|
785 |
@gr.on(triggers = [in_data_file.upload, in_data_file.clear, in_samplerate.change, out_json_file.change],
|
786 |
+
inputs = [stage1_json, in_data_file, in_samplerate], outputs = run_btn)
|
787 |
def check_input(stage1_info, in_data, samplerate):
|
788 |
if stage1_info["state"]=="finished" and in_data!=None and samplerate!="":
|
789 |
return gr.Button(interactive=True)
|
790 |
else:
|
791 |
return gr.Button(interactive=False)
|
792 |
|
793 |
+
@cancel_btn.click(inputs = stage2_json, outputs = [stage2_json, cancel_btn, batch_md])
|
794 |
def stop_processing(stage2_info):
|
795 |
utils.dataDelete(stage2_info["filePath"])
|
796 |
stage2_info["state"] = "interrupted"
|
|
|
819 |
"state" : "running",
|
820 |
"sampleRate" : int(samplerate)
|
821 |
}
|
822 |
+
return {stage2_json : stage2_info,
|
823 |
run_btn : gr.Button(visible=False),
|
824 |
cancel_btn : gr.Button(visible=True, interactive=True),
|
825 |
batch_md : gr.Markdown("", visible=True),
|
|
|
874 |
cancel_btn : gr.Button(visible=False)}
|
875 |
else:
|
876 |
stage2_info["state"] = "finished"
|
877 |
+
yield {stage2_json : stage2_info,
|
878 |
run_btn : gr.Button(visible=True),
|
879 |
cancel_btn : gr.Button(visible=False),
|
880 |
batch_md : gr.Markdown(visible=False),
|
|
|
883 |
run_btn.click(
|
884 |
fn = reset_run,
|
885 |
inputs = [in_data_file, in_samplerate, in_modelname],
|
886 |
+
outputs = [stage2_json, run_btn, cancel_btn, batch_md, out_data_file]
|
887 |
).success(
|
888 |
fn = run_model,
|
889 |
+
inputs = [stage1_json, stage2_json, in_modelname],
|
890 |
+
outputs = [stage2_json, run_btn, cancel_btn, batch_md, out_data_file]
|
891 |
)
|
892 |
|
893 |
if __name__ == "__main__":
|