Spaces:
Runtime error
Runtime error
import streamlit as st | |
import paddleocr | |
# Set up the OCR model | |
model = paddleocr.create_model(mode='rec', lang='ch_sim') | |
def ocr_image(image): | |
# Perform OCR on the image | |
text = model.recognize(image) | |
return text | |
# Set up the Streamlit app | |
st.title('OCR App') | |
# Add a file upload widget | |
uploaded_file = st.file_uploader('Choose an image file') | |
if uploaded_file is not None: | |
# Read the image file | |
image = Image.open(uploaded_file) | |
# Perform OCR on the image | |
text = ocr_image(image) | |
# Display the OCR results | |
st.text(text) | |