Spaces:
Running
Running
File size: 857 Bytes
fc691a3 57b8db4 69a22be fc691a3 69a22be fc691a3 69a22be 57b8db4 69a22be 57b8db4 69a22be fc691a3 69a22be |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import streamlit as st
from PIL import Image
import easyocr
import numpy as np
# Initialize EasyOCR Reader for specific languages
reader = easyocr.Reader(['en', 'ur']) # Include 'ur' for Urdu
# Title
st.title("OCR App with EasyOCR")
# File uploader
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
if uploaded_file is not None:
# Open and display the image
image = Image.open(uploaded_file)
st.image(image, caption="Uploaded Image", use_column_width=True)
# Convert to numpy array for OCR
img_array = np.array(image)
# Perform OCR
with st.spinner("Processing..."):
results = reader.readtext(img_array)
# Display results
detected_text = ""
for (bbox, text, prob) in results:
detected_text += f"{text} "
st.write("Detected Text:", detected_text)
|