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)