bunnyroshan commited on
Commit
e5caf23
·
verified ·
1 Parent(s): 6a05d5d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -7
app.py CHANGED
@@ -55,14 +55,22 @@ def predict_video(video):
55
 
56
  # Define Gradio interface
57
  iface = gr.Interface(
58
- fn={"Image": predict_image, "Video": predict_video},
59
- inputs={"Image": gr.inputs.Image(type="numpy", label="Upload an Image"),
60
- "Video": gr.inputs.Video(label="Upload a Video")},
61
- outputs={"Image": gr.outputs.Image(type="numpy", label="Detected Objects"),
62
- "Video": gr.outputs.Video(label="Processed Video")},
63
  title="YOLOv8 Object Detection",
64
- description="Upload an image or a video and get detected objects using YOLOv8"
65
  )
66
 
 
 
 
 
 
 
 
 
 
 
67
  if __name__ == "__main__":
68
- iface.launch()
 
55
 
56
  # Define Gradio interface
57
  iface = gr.Interface(
58
+ fn=predict_image,
59
+ inputs=gr.Image(type="numpy", label="Upload an Image"),
60
+ outputs=gr.Image(type="numpy", label="Detected Objects"),
 
 
61
  title="YOLOv8 Object Detection",
62
+ description="Upload an image and get detected objects using YOLOv8"
63
  )
64
 
65
+ iface_video = gr.Interface(
66
+ fn=predict_video,
67
+ inputs=gr.Video(label="Upload a Video"),
68
+ outputs=gr.Video(label="Processed Video"),
69
+ title="YOLOv8 Object Detection",
70
+ description="Upload a video and get detected objects using YOLOv8"
71
+ )
72
+
73
+ demo = gr.TabbedInterface([iface, iface_video], ["Image Detection", "Video Detection"])
74
+
75
  if __name__ == "__main__":
76
+ demo.launch()