res / app.py
sarahai's picture
Update app.py
58146ac verified
raw
history blame
No virus
694 Bytes
import streamlit as st
import easyocr
from PIL import Image
# Initialize the EasyOCR Reader
reader = easyocr.Reader(['en'])
# Streamlit interface
st.title("OCR with EasyOCR")
# Upload image
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
if uploaded_file:
# Open image file
image = Image.open(uploaded_file)
st.image(image, caption='Uploaded Image', use_column_width=True)
# Run OCR
result = reader.readtext(image)
# Display OCR results
st.subheader("OCR Results:")
for detection in result:
text = detection[1]
bbox = detection[0]
st.write(f"Text: {text}")
st.write(f"Bounding Box: {bbox}")