insideman commited on
Commit
3ae25e3
·
verified ·
1 Parent(s): 9df1f85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -18
app.py CHANGED
@@ -90,25 +90,12 @@ def set_example_image(example: list) -> dict:
90
  def set_example_url(example: list) -> dict:
91
  return gr.Textbox.update(value=example[0]), gr.Image.update(value=get_original_image(example[0]))
92
 
93
- title = """<h1 id="title">License Plate Detection with YOLOS</h1>"""
94
-
95
- description = """
96
- YOLOS is a Vision Transformer (ViT) trained using the DETR loss. Despite its simplicity, a base-sized YOLOS model is able to achieve 42 AP on COCO validation 2017 (similar to DETR and more complex frameworks such as Faster R-CNN).
97
- The YOLOS model was fine-tuned on COCO 2017 object detection (118k annotated images). It was introduced in the paper [You Only Look at One Sequence: Rethinking Transformer in Vision through Object Detection](https://arxiv.org/abs/2106.00666) by Fang et al. and first released in [this repository](https://github.com/hustvl/YOLOS).
98
- This model was further fine-tuned on the [Car license plate dataset]("https://www.kaggle.com/datasets/andrewmvd/car-plate-detection") from Kaggle. The dataset consists of 443 images of vehicle with annotations categorised as "Vehicle" and "Rego Plates". The model was trained for 200 epochs on a single GPU.
99
- Links to HuggingFace Models:
100
- - [nickmuchi/yolos-small-rego-plates-detection](https://huggingface.co/nickmuchi/yolos-small-rego-plates-detection)
101
- - [hustlv/yolos-small](https://huggingface.co/hustlv/yolos-small)
102
- """
103
 
104
  models = ["nickmuchi/yolos-small-finetuned-license-plate-detection", "nickmuchi/detr-resnet50-license-plate-detection"]
105
  urls = ["https://drive.google.com/uc?id=1j9VZQ4NDS4gsubFf3m2qQoTMWLk552bQ", "https://drive.google.com/uc?id=1p9wJIqRz3W50e2f_A0D8ftla8hoXz4T5"]
106
  images = [[path.as_posix()] for path in sorted(pathlib.Path('images').rglob('*.j*g'))]
107
 
108
- twitter_link = """
109
- [![](https://img.shields.io/twitter/follow/nickmuchi?label=@nickmuchi&style=social)](https://twitter.com/nickmuchi)
110
- """
111
-
112
  css = '''
113
  h1#title {
114
  text-align: center;
@@ -117,9 +104,7 @@ h1#title {
117
  demo = gr.Blocks(css=css)
118
 
119
  with demo:
120
- gr.Markdown(title)
121
- gr.Markdown(description)
122
- gr.Markdown(twitter_link)
123
  options = gr.Dropdown(choices=models, label='Object Detection Model', value=models[0], show_label=True)
124
  slider_input = gr.Slider(minimum=0.2, maximum=1, value=0.5, step=0.1, label='Prediction Threshold')
125
 
@@ -146,7 +131,7 @@ with demo:
146
 
147
  with gr.TabItem('WebCam'):
148
  with gr.Row():
149
- web_input = gr.Image(type='pil')
150
  img_output_from_webcam = gr.Image()
151
  cam_but = gr.Button('Detect')
152
 
 
90
  def set_example_url(example: list) -> dict:
91
  return gr.Textbox.update(value=example[0]), gr.Image.update(value=get_original_image(example[0]))
92
 
93
+ title = """<h1 id="title">License Plate Detection with YOLOS</h1>"""
 
 
 
 
 
 
 
 
 
94
 
95
  models = ["nickmuchi/yolos-small-finetuned-license-plate-detection", "nickmuchi/detr-resnet50-license-plate-detection"]
96
  urls = ["https://drive.google.com/uc?id=1j9VZQ4NDS4gsubFf3m2qQoTMWLk552bQ", "https://drive.google.com/uc?id=1p9wJIqRz3W50e2f_A0D8ftla8hoXz4T5"]
97
  images = [[path.as_posix()] for path in sorted(pathlib.Path('images').rglob('*.j*g'))]
98
 
 
 
 
 
99
  css = '''
100
  h1#title {
101
  text-align: center;
 
104
  demo = gr.Blocks(css=css)
105
 
106
  with demo:
107
+ gr.Markdown(title)
 
 
108
  options = gr.Dropdown(choices=models, label='Object Detection Model', value=models[0], show_label=True)
109
  slider_input = gr.Slider(minimum=0.2, maximum=1, value=0.5, step=0.1, label='Prediction Threshold')
110
 
 
131
 
132
  with gr.TabItem('WebCam'):
133
  with gr.Row():
134
+ web_input = gr.Camera()
135
  img_output_from_webcam = gr.Image()
136
  cam_but = gr.Button('Detect')
137