audrey06100 commited on
Commit
8d3606f
·
1 Parent(s): 745cb1d
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -292,7 +292,7 @@ with gr.Blocks() as demo:
292
  # | Stage1: channel mapping |
293
  # +========================================================================================+
294
  def reset_all(stage1_info, stage2_info, in_loc):
295
- # interrupt Stage2
296
  if stage2_info!=None and stage2_info["state"]=="running":
297
  utils.dataDelete(stage2_info["filePath"])
298
 
@@ -796,11 +796,11 @@ with gr.Blocks() as demo:
796
  return gr.Button(interactive=True)
797
  else:
798
  return gr.Button(interactive=False)
799
- # interrupt Stage2
800
  @cancel_btn.click(inputs = stage2_json, outputs = [stage2_json, cancel_btn, batch_md])
801
  def stop_processing(stage2_info):
802
  utils.dataDelete(stage2_info["filePath"])
803
- stage2_info["state"] = "interrupted"
804
  return stage2_info, gr.Button(interactive=False), gr.Markdown(visible=False)
805
 
806
  def reset_stage2(in_data, samplerate, modelname):
@@ -840,7 +840,7 @@ with gr.Blocks() as demo:
840
  filename = stage2_info["fileNames"]["inputData"]
841
  new_filename = stage2_info["fileNames"]["outputData"]
842
 
843
- break_flag = False # indicate if the process has been interrupted
844
  for i in range(batch_num):
845
  yield {batch_md : gr.Markdown('Running model({}/{})...'.format(i+1, batch_num))}
846
 
 
292
  # | Stage1: channel mapping |
293
  # +========================================================================================+
294
  def reset_all(stage1_info, stage2_info, in_loc):
295
+ # stop Stage2
296
  if stage2_info!=None and stage2_info["state"]=="running":
297
  utils.dataDelete(stage2_info["filePath"])
298
 
 
796
  return gr.Button(interactive=True)
797
  else:
798
  return gr.Button(interactive=False)
799
+
800
  @cancel_btn.click(inputs = stage2_json, outputs = [stage2_json, cancel_btn, batch_md])
801
  def stop_processing(stage2_info):
802
  utils.dataDelete(stage2_info["filePath"])
803
+ stage2_info["state"] = "stopped"
804
  return stage2_info, gr.Button(interactive=False), gr.Markdown(visible=False)
805
 
806
  def reset_stage2(in_data, samplerate, modelname):
 
840
  filename = stage2_info["fileNames"]["inputData"]
841
  new_filename = stage2_info["fileNames"]["outputData"]
842
 
843
+ break_flag = False
844
  for i in range(batch_num):
845
  yield {batch_md : gr.Markdown('Running model({}/{})...'.format(i+1, batch_num))}
846