update app.py with description and add description.html file

#1
Files changed (2) hide show
  1. app.py +5 -2
  2. description.html +24 -0
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
  import cv2
3
- import requests
4
  import os
5
  from PIL import Image
6
  from ultralytics import YOLO
@@ -8,7 +8,8 @@ from ultralytics import YOLO
8
 
9
  ################## MODEL ##################
10
  model = YOLO('best.pt')
11
- title = "RSUD20K"
 
12
 
13
  ################## IMAGE ##################
14
 
@@ -31,6 +32,7 @@ def show_preds_image(image_path):
31
  demo_image = gr.Interface(
32
  fn=show_preds_image,
33
  title=title,
 
34
  inputs= inputs_image,
35
  outputs= outputs_image,
36
  examples= [os.path.join(Image_directory, fname) for fname in os.listdir(Image_directory) if fname.endswith(".jpg")],
@@ -69,6 +71,7 @@ def show_preds_video(video_path):
69
  demo_video = gr.Interface(
70
  fn=show_preds_video,
71
  title=title,
 
72
  inputs= inputs_video,
73
  outputs= outputs_video,
74
  examples= [os.path.join(Video_directory, fname) for fname in os.listdir(Video_directory) if fname.endswith(".mp4")],
 
1
  import gradio as gr
2
  import cv2
3
+ import codecs
4
  import os
5
  from PIL import Image
6
  from ultralytics import YOLO
 
8
 
9
  ################## MODEL ##################
10
  model = YOLO('best.pt')
11
+ title = "RSUD20K: A Dataset for Road Scene Understanding In Autonomous Driving"
12
+ description = codecs.open("description.html", "r", "utf-8").read()
13
 
14
  ################## IMAGE ##################
15
 
 
32
  demo_image = gr.Interface(
33
  fn=show_preds_image,
34
  title=title,
35
+ description=description,
36
  inputs= inputs_image,
37
  outputs= outputs_image,
38
  examples= [os.path.join(Image_directory, fname) for fname in os.listdir(Image_directory) if fname.endswith(".jpg")],
 
71
  demo_video = gr.Interface(
72
  fn=show_preds_video,
73
  title=title,
74
+ description=description,
75
  inputs= inputs_video,
76
  outputs= outputs_video,
77
  examples= [os.path.join(Video_directory, fname) for fname in os.listdir(Video_directory) if fname.endswith(".mp4")],
description.html ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Title</title>
6
+ </head>
7
+ <body>
8
+ Try this demo for an object detector trained on <a href="https://github.com/hasibzunair/RSUD20K">RSUD20K</a>,
9
+ introduced in our paper <a href="https://arxiv.org/abs/2401.07322">RSUD20K: A Dataset for Road Scene Understanding In Autonomous Driving</a>.
10
+ </br>
11
+ RSUD20K is a new object detection dataset for road scene understanding,
12
+ comprised of over 20K high-resolution images from the driving perspective
13
+ on Bangladesh roads, and includes 130K bounding box annotations for
14
+ 13 objects.
15
+ </br>
16
+ You can use this demo to get the a bounding box and class label predictions of objects present in your images or videos. To use it, simply
17
+ upload an image or video of your choice and hit submit. You will get one or more bounding boxes and names of objects present
18
+ in your images or videos from this list:
19
+ (person, rickshaw, rickshaw van, auto rickshaw, truck, pickup truck, private car, motorcycle, bicycle, bus, micro bus, covered van, human hauler)
20
+ </br>
21
+ <a href="https://www.kaggle.com/datasets/hasibzunair/rsud20k-bangladesh-road-scene-understanding">Dataset Page</a>
22
+ </br>
23
+ </body>
24
+ </html>