Spaces:
Runtime error
Runtime error
File size: 546 Bytes
d1278a0 1f5596d d1278a0 1f5596d d1278a0 1f5596d d1278a0 70ac413 d1278a0 1f5596d d1278a0 1f5596d d1278a0 1f5596d |
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 |
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)
|