Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from ocrFuncs import imgOCR_img2text
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
st.write("Upload an image and this app will scan it for text")
|
| 6 |
+
user_image_object = st.file_uploader("upload your image", type=['png', 'jpg'], accept_multiple_files=False)
|
| 7 |
+
|
| 8 |
+
if user_image_object is not None:
|
| 9 |
+
st.image(user_image_object )
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
user_image_name = "input_image.png"
|
| 13 |
+
|
| 14 |
+
input_image = Image.open( user_image_object )
|
| 15 |
+
input_image.save(user_image_name )
|
| 16 |
+
|
| 17 |
+
outputText = imgOCR_img2text(user_image_name) #takes a filname as input since easyOCR takes filenames as input
|
| 18 |
+
|
| 19 |
+
st.write(outputText )
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|