Sourudra commited on
Commit
6282d95
·
verified ·
1 Parent(s): 8f14673

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -28
app.py CHANGED
@@ -1,8 +1,8 @@
1
- import streamlit as st
2
  from ultralytics import YOLO
3
  import numpy as np
4
  import cv2
5
  from PIL import Image
 
6
 
7
  # Model labels
8
  model1Labels = {0: 'single_number_plate', 1: 'double_number_plate'}
@@ -87,36 +87,11 @@ def prediction(image):
87
  st.title('License Plate Recognition 🚗')
88
  st.header('Upload an image of a license plate to get the License number.')
89
 
90
- # Define example images (update with actual paths)
91
- example_images = {
92
- "Car ": "test/audiR8V10.jpg",
93
- "Car 2": "test/c7.jpg",
94
- "Car 3": "test/c4.jpg",
95
- "CCTV B/W": "test/cctv img plate.jpg",
96
- "Bike": "test/BikeNumberPlate.jpg",
97
- "Bus": "test/bus.jpg",
98
- }
99
-
100
- # File uploader
101
  uploaded_file = st.file_uploader("Choose an image...", type="jpg")
102
 
103
-
104
-
105
- c1, c2 = st.columns(2)
106
- for name, path in example_images.items():
107
- with c1:
108
- example_img = Image.open(path)
109
-
110
- image = None
111
  if uploaded_file is not None:
112
  image = np.array(Image.open(uploaded_file))
113
- else:
114
- st.header("Or choose an example image from below dropdown:")
115
- selected_example = st.selectbox("", list(example_images.keys()))
116
- if selected_example:
117
- image = np.array(Image.open(example_images[selected_example]))
118
-
119
- if image is not None:
120
  c1, c2, c3 = st.columns(3)
121
 
122
  with c1:
@@ -133,4 +108,3 @@ if image is not None:
133
  with c3:
134
  st.success(', '.join(license_plate_text))
135
  st.write('License Plate Text')
136
-
 
 
1
  from ultralytics import YOLO
2
  import numpy as np
3
  import cv2
4
  from PIL import Image
5
+ import streamlit as st
6
 
7
  # Model labels
8
  model1Labels = {0: 'single_number_plate', 1: 'double_number_plate'}
 
87
  st.title('License Plate Recognition 🚗')
88
  st.header('Upload an image of a license plate to get the License number.')
89
 
90
+ # File uploader for user to upload an image
 
 
 
 
 
 
 
 
 
 
91
  uploaded_file = st.file_uploader("Choose an image...", type="jpg")
92
 
 
 
 
 
 
 
 
 
93
  if uploaded_file is not None:
94
  image = np.array(Image.open(uploaded_file))
 
 
 
 
 
 
 
95
  c1, c2, c3 = st.columns(3)
96
 
97
  with c1:
 
108
  with c3:
109
  st.success(', '.join(license_plate_text))
110
  st.write('License Plate Text')