Spaces:
Runtime error
Runtime error
File size: 513 Bytes
d1278a0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import streamlit as st
import paddleocr
# Initialize the OCR engine
engine = paddleocr.create_engine()
def ocr(image):
# Perform OCR on the image
text = engine.run(image)
# Display the OCR results
st.markdown(f'**OCR Output:**\n{text}')
# Set up the Streamlit app
st.title('Image OCR')
# Add a file uploader to the app
image = st.file_uploader('Choose an image')
# If an image is uploaded, display it and perform OCR on it
if image is not None:
st.image(image, caption='Input Image')
ocr(image)
|