File size: 730 Bytes
58146ac b93afe7 7ddd450 58146ac 7ddd450 58146ac 7ddd450 58146ac 7ddd450 58146ac 7ddd450 |
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 |
import streamlit as st
import easyocr
import io
from PIL import Image
# Initialize the EasyOCR reader
reader = easyocr.Reader(['en'])
# Function to extract text from image
def extract_text_from_image(image):
result = reader.readtext(image)
extracted_text = "\n".join([text[1] for text in result])
return extracted_text
# Streamlit interface
st.title("OCR Text Extraction with EasyOCR")
uploaded_file = st.file_uploader("Upload an image (JPG, PNG, etc.)", type=["jpg", "png"])
if uploaded_file:
# Read the image file
image = Image.open(uploaded_file)
# Extract text from the image
extracted_text = extract_text_from_image(image)
st.subheader("Extracted Text:")
st.write(extracted_text)
|