Spaces:
Running
Running
Update app.py
Browse files
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(
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
| 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:
|