File size: 846 Bytes
3818b72 61df1f9 3818b72 61df1f9 3818b72 61df1f9 3818b72 61df1f9 3818b72 61df1f9 3818b72 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import gradio as gr
from utils import object_detection_brainai as odb
object_detection = odb.ObjectDetectionModel()
def detect_image(img):
result_img = object_detection.process(img)
return result_img
def detect_video(video_path):
output_video_path = object_detection.play_video(video_path)
return output_video_path
image_interface = gr.Interface(
fn=detect_image,
title="Image Object Detection",
inputs=gr.Image(label="Upload Image"),
outputs="image",
examples = ['data/office.jpg', 'data/classroom.jpg'])
video_interface = gr.Interface(
fn=detect_video,
inputs=gr.Video(label="Upload Video"),
examples = ['data/breakfast-example.mp4'],
outputs="video",
title="Video Object Detection")
demo = gr.TabbedInterface([image_interface, video_interface], ["Image", "Video"])
demo.launch()
|