Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import easyocr as ocr | |
| import numpy as np | |
| from PIL import Image | |
| st.title("Image to Text Toy Application") | |
| image = st.file_uploader(label = "Upload your image here", type=['png','jpg','jpeg']) | |
| def load_model(): | |
| reader = ocr.Reader(['en'],model_storage_directory='stabilityai/stable-code-3b') | |
| return reader | |
| reader = load_model() | |
| if image is not None: | |
| input_image = Image.open(image) | |
| st.image(input_image) | |
| with st.spinner("AI is processing your request."): | |
| result = reader.readtext(np.array(input_image)) | |
| result_text = [] | |
| for text in result: | |
| result_text.append(text[1]) | |
| st.write(result_text) | |
| st.balloons() | |
| else: | |
| st.write("Upload an Image") |