barry-ravichandran commited on
Commit
7984e9a
·
1 Parent(s): c9a614c

Fixed gradio blocks UI code

Browse files
Files changed (1) hide show
  1. app.py +40 -40
app.py CHANGED
@@ -552,45 +552,45 @@ with gr.Blocks() as demo:
552
  with TabItem("Display saliency map plot"):
553
  det_saliency_plot = Plot()
554
 
555
- # Image Classification dropdown list event listeners
556
- drop_list.select(select_img_cls_model,drop_list,drop_list)
557
- drop_list_sal.select(select_img_cls_saliency_algo,drop_list_sal,drop_list_sal)
558
- drop_list_sal.change(show_textbox_parameters,drop_list_sal,[window_size,stride,masks,spatial_res,seed])
559
- drop_list_sal.change(show_slider_parameters,drop_list_sal,[threads,p1])
560
- drop_list_sal.change(show_debiased_checkbox,drop_list_sal,debiased)
561
-
562
- # Image Classification textbox, slider and checkbox event listeners
563
- window_size.submit(enter_window_size,window_size,window_size)
564
- masks.submit(enter_num_masks,masks,masks)
565
- stride.submit(enter_stride, stride, stride)
566
- spatial_res.submit(enter_spatial_res, spatial_res, spatial_res)
567
- seed.submit(enter_seed, seed, seed)
568
- threads.change(select_threads, threads, threads)
569
- p1.change(select_p1, p1, p1)
570
- debiased.change(check_debiased,debiased,debiased)
571
-
572
- # Image Classification prediction and saliency generation event listeners
573
- classify.click(predict, [input_img, num_classes], [class_label,class_name])
574
- class_label.select(map_labels,None,class_name)
575
- generate_saliency.click(interpretation_function, [input_img, class_label, class_name, img_alpha, sal_alpha, min_sal_range, max_sal_range], [interpretation,interpretation_plot])
576
-
577
- # Object Detection dropdown list event listeners
578
- drop_list_detect_model.select(select_obj_det_model,drop_list_detect_model,drop_list_detect_model)
579
- drop_list_detect_sal.select(select_obj_det_saliency_algo,drop_list_detect_sal,drop_list_detect_sal)
580
- drop_list_detect_sal.change(show_slider_parameters,drop_list_detect_sal,[threads_detect,p1_detect])
581
- drop_list_detect_sal.change(show_textbox_parameters,drop_list_detect_sal,[masks_detect,spatial_res_detect,seed_detect,occlusion_grid_size])
582
-
583
- # Object detection textbox and slider event listeners
584
- masks_detect.submit(enter_num_masks,masks_detect,masks_detect)
585
- occlusion_grid_size.submit(enter_occlusion_grid_size,occlusion_grid_size,occlusion_grid_size)
586
- spatial_res_detect.submit(enter_spatial_res, spatial_res_detect, spatial_res_detect)
587
- seed_detect.submit(enter_seed, seed_detect, seed_detect)
588
- threads_detect.change(select_threads, threads_detect, threads_detect)
589
- p1_detect.change(select_p1, p1_detect, p1_detect)
590
-
591
- # Object detection prediction, class selection and saliency generation event listeners
592
- detection.click(run_detect, [input_img_detect, num_detections], [detect_label,class_name_det])
593
- detect_label.select(map_labels, None, class_name_det)
594
- generate_det_saliency.click(run_detect_saliency,[input_img_detect, num_detections, class_name_det, img_alpha_det, sal_alpha_det, min_sal_range_det, max_sal_range_det],det_saliency_plot)
595
 
596
  demo.launch()
 
552
  with TabItem("Display saliency map plot"):
553
  det_saliency_plot = Plot()
554
 
555
+ # Image Classification dropdown list event listeners
556
+ drop_list.select(select_img_cls_model,drop_list,drop_list)
557
+ drop_list_sal.select(select_img_cls_saliency_algo,drop_list_sal,drop_list_sal)
558
+ drop_list_sal.change(show_textbox_parameters,drop_list_sal,[window_size,stride,masks,spatial_res,seed])
559
+ drop_list_sal.change(show_slider_parameters,drop_list_sal,[threads,p1])
560
+ drop_list_sal.change(show_debiased_checkbox,drop_list_sal,debiased)
561
+
562
+ # Image Classification textbox, slider and checkbox event listeners
563
+ window_size.submit(enter_window_size,window_size,window_size)
564
+ masks.submit(enter_num_masks,masks,masks)
565
+ stride.submit(enter_stride, stride, stride)
566
+ spatial_res.submit(enter_spatial_res, spatial_res, spatial_res)
567
+ seed.submit(enter_seed, seed, seed)
568
+ threads.change(select_threads, threads, threads)
569
+ p1.change(select_p1, p1, p1)
570
+ debiased.change(check_debiased,debiased,debiased)
571
+
572
+ # Image Classification prediction and saliency generation event listeners
573
+ classify.click(predict, [input_img, num_classes], [class_label,class_name])
574
+ class_label.select(map_labels,None,class_name)
575
+ generate_saliency.click(interpretation_function, [input_img, class_label, class_name, img_alpha, sal_alpha, min_sal_range, max_sal_range], [interpretation,interpretation_plot])
576
+
577
+ # Object Detection dropdown list event listeners
578
+ drop_list_detect_model.select(select_obj_det_model,drop_list_detect_model,drop_list_detect_model)
579
+ drop_list_detect_sal.select(select_obj_det_saliency_algo,drop_list_detect_sal,drop_list_detect_sal)
580
+ drop_list_detect_sal.change(show_slider_parameters,drop_list_detect_sal,[threads_detect,p1_detect])
581
+ drop_list_detect_sal.change(show_textbox_parameters,drop_list_detect_sal,[masks_detect,spatial_res_detect,seed_detect,occlusion_grid_size])
582
+
583
+ # Object detection textbox and slider event listeners
584
+ masks_detect.submit(enter_num_masks,masks_detect,masks_detect)
585
+ occlusion_grid_size.submit(enter_occlusion_grid_size,occlusion_grid_size,occlusion_grid_size)
586
+ spatial_res_detect.submit(enter_spatial_res, spatial_res_detect, spatial_res_detect)
587
+ seed_detect.submit(enter_seed, seed_detect, seed_detect)
588
+ threads_detect.change(select_threads, threads_detect, threads_detect)
589
+ p1_detect.change(select_p1, p1_detect, p1_detect)
590
+
591
+ # Object detection prediction, class selection and saliency generation event listeners
592
+ detection.click(run_detect, [input_img_detect, num_detections], [detect_label,class_name_det])
593
+ detect_label.select(map_labels, None, class_name_det)
594
+ generate_det_saliency.click(run_detect_saliency,[input_img_detect, num_detections, class_name_det, img_alpha_det, sal_alpha_det, min_sal_range_det, max_sal_range_det],det_saliency_plot)
595
 
596
  demo.launch()