# Gradio app for YOLOv3 import numpy as np import gradio as gr from pytorch_grad_cam import GradCAM from pytorch_grad_cam.utils.image import show_cam_on_image from pytorch_grad_cam.utils.model_targets import ClassifierOutputTarget from display import inference, draw_predictions gr.Interface( inference, inputs=[ gr.Image(label="Input Image"), gr.Slider(0, 1, value=0.50, label="IOU Threshold"), gr.Slider(0, 1, value=0.50, label="Threshold"), gr.Checkbox(label="Show GradCam Image"), gr.Slider(0, 1, value=0.5, label="Opacity of GradCAM"), ], outputs=gr.Gallery(rows=2, columns=1), title = "Object Detection : YoloV3 on PASCAL VOC Dataset From Scratch (with GradCAM)" ,examples=[ ["Examples/000001.jpg", 0.75, 0.75, True, 0.5], ["Examples/000002.jpg", 0.75, 0.75, True, 0.5], ["Examples/000003.jpg", 0.75, 0.75, True, 0.5], ["Examples/000004.jpg", 0.75, 0.75, True, 0.5], ["Examples/000005.jpg", 0.75, 0.75, True, 0.5], ["Examples/000006.jpg", 0.75, 0.75, True, 0.5], ["Examples/000007.jpg", 0.75, 0.75, True, 0.5], ["Examples/000008.jpg", 0.75, 0.75, True, 0.5], ["Examples/000009.jpg", 0.75, 0.75, True, 0.5], ["Examples/000010.jpg", 0.75, 0.75, True, 0.5] ] , layout="horizontal" ).launch()