ankandrew commited on
Commit
b80d21a
1 Parent(s): eac4457

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -43,14 +43,17 @@ if uploaded_file is not None:
43
  annotated_img_array = alpr.draw_predictions(img_array)
44
 
45
  # Convert the annotated image back to display in Streamlit
46
- annotated_img = Image.fromarray(cv2.cvtColor(annotated_img_array, cv2.COLOR_BGR2RGB))
47
  st.image(annotated_img, caption="Annotated Image with OCR Results", use_column_width=True)
48
 
49
  # Display OCR results in text format for more detail
50
  if results:
51
  st.write("**OCR Results:**")
52
  for result in results:
53
- st.write(f"- Detected Plate: `{result['text']}` with confidence `{result['confidence']:.2f}`")
 
 
 
54
  else:
55
  st.write("No license plate detected.")
56
  else:
 
43
  annotated_img_array = alpr.draw_predictions(img_array)
44
 
45
  # Convert the annotated image back to display in Streamlit
46
+ annotated_img = Image.fromarray(annotated_img_array)
47
  st.image(annotated_img, caption="Annotated Image with OCR Results", use_column_width=True)
48
 
49
  # Display OCR results in text format for more detail
50
  if results:
51
  st.write("**OCR Results:**")
52
  for result in results:
53
+ # Access the detection and OCR attributes from ALPRResult
54
+ plate_text = result.ocr.text if result.ocr else "N/A"
55
+ plate_confidence = result.ocr.confidence if result.ocr else 0.0
56
+ st.write(f"- Detected Plate: `{plate_text}` with confidence `{plate_confidence:.2f}`")
57
  else:
58
  st.write("No license plate detected.")
59
  else: