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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -87,21 +87,24 @@ 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
- # 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:
98
- st.image(image, caption='Uploaded Image', use_column_width=True)
99
 
100
  license_plate_text, img_lp = prediction(image)
101
 
102
  with c2:
103
  if img_lp is not None:
104
- st.image(img_lp, caption='Cropped License Plate', use_column_width=True)
105
  else:
106
  st.write('No License Plate Detected')
107
 
 
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
91
  uploaded_file = st.file_uploader("Choose an image...", type="jpg")
92
 
93
+ image = None
94
  if uploaded_file is not None:
95
  image = np.array(Image.open(uploaded_file))
96
+
97
+ if image is not None:
98
  c1, c2, c3 = st.columns(3)
99
 
100
  with c1:
101
+ st.image(image, caption='Uploaded Image', use_container_width=True)
102
 
103
  license_plate_text, img_lp = prediction(image)
104
 
105
  with c2:
106
  if img_lp is not None:
107
+ st.image(img_lp, caption='Cropped License Plate', use_container_width=True)
108
  else:
109
  st.write('No License Plate Detected')
110