Spaces:
Sleeping
Sleeping
deepanshu2207
commited on
Commit
•
2e1e1c3
1
Parent(s):
2f4b113
Updated ocr reader parameters
Browse files
app.py
CHANGED
@@ -14,14 +14,16 @@ st.markdown("Used Github Actions to automatically build the app on any updates o
|
|
14 |
#image uploader
|
15 |
image = st.file_uploader(label = "Upload your image here",type=['png','jpg','jpeg'])
|
16 |
|
|
|
17 |
|
18 |
@st.cache_resource
|
19 |
def load_model():
|
20 |
-
reader = ocr.Reader(['en'],model_storage_directory='.')
|
21 |
return reader
|
22 |
|
23 |
|
24 |
reader = load_model() #load model
|
|
|
25 |
|
26 |
|
27 |
if image is not None:
|
@@ -33,7 +35,7 @@ if image is not None:
|
|
33 |
|
34 |
with st.spinner("🤖 AI is at Work! "):
|
35 |
print(np.array(input_image))
|
36 |
-
result = reader.readtext(np.array(input_image))
|
37 |
print('4. Image Text Read')
|
38 |
|
39 |
result_text = [] #empty list for results
|
|
|
14 |
#image uploader
|
15 |
image = st.file_uploader(label = "Upload your image here",type=['png','jpg','jpeg'])
|
16 |
|
17 |
+
print('Before model load func')
|
18 |
|
19 |
@st.cache_resource
|
20 |
def load_model():
|
21 |
+
reader = ocr.Reader(['en'], detector='dbnet18', gpu=False, verbose=True, model_storage_directory='.')
|
22 |
return reader
|
23 |
|
24 |
|
25 |
reader = load_model() #load model
|
26 |
+
print('After model load func')
|
27 |
|
28 |
|
29 |
if image is not None:
|
|
|
35 |
|
36 |
with st.spinner("🤖 AI is at Work! "):
|
37 |
print(np.array(input_image))
|
38 |
+
result = reader.readtext(np.array(input_image), batch_size=5)
|
39 |
print('4. Image Text Read')
|
40 |
|
41 |
result_text = [] #empty list for results
|