Spaces:
Sleeping
Sleeping
Add clear caches
Browse files
app_pages/__pycache__/ocr_comparator.cpython-37.pyc
CHANGED
|
Binary files a/app_pages/__pycache__/ocr_comparator.cpython-37.pyc and b/app_pages/__pycache__/ocr_comparator.cpython-37.pyc differ
|
|
|
app_pages/ocr_comparator.py
CHANGED
|
@@ -155,7 +155,7 @@ def app():
|
|
| 155 |
if 'columns_size' not in st.session_state:
|
| 156 |
st.session_state.columns_size = [2] + [1 for x in out_reader_type_list[1:]]
|
| 157 |
if 'column_width' not in st.session_state:
|
| 158 |
-
st.session_state.column_width = [
|
| 159 |
if 'columns_color' not in st.session_state:
|
| 160 |
st.session_state.columns_color = ["rgb(228,26,28)"] + \
|
| 161 |
["rgb(0,0,0)" for x in out_reader_type_list[1:]]
|
|
@@ -851,7 +851,7 @@ def app():
|
|
| 851 |
with show_reco.container():
|
| 852 |
# Draw the results, 2 images per line
|
| 853 |
reco_lines = math.ceil(len(in_reader_type_list) / 2)
|
| 854 |
-
column_width =
|
| 855 |
for ind_lig in range(0, reco_lines+1, 2):
|
| 856 |
cols = st.columns(2)
|
| 857 |
for ind_col in range(2):
|
|
@@ -882,10 +882,10 @@ def app():
|
|
| 882 |
"""
|
| 883 |
with show_detect.container():
|
| 884 |
columns_size = [1 for x in reader_type_list]
|
| 885 |
-
column_width = [
|
| 886 |
columns_color = ["rgb(0,0,0)" for x in reader_type_list]
|
| 887 |
columns_size[reader_type_dict[st.session_state.detect_reader]] = 2
|
| 888 |
-
column_width[reader_type_dict[st.session_state.detect_reader]] =
|
| 889 |
columns_color[reader_type_dict[st.session_state.detect_reader]] = "rgb(228,26,28)"
|
| 890 |
columns = st.columns(columns_size, ) #gap='medium')
|
| 891 |
|
|
@@ -895,7 +895,7 @@ def app():
|
|
| 895 |
col.markdown(column_title, unsafe_allow_html=True)
|
| 896 |
if isinstance(list_images[ind_col+2], PIL.Image.Image):
|
| 897 |
col.image(list_images[ind_col+2], width=column_width[ind_col], \
|
| 898 |
-
|
| 899 |
else:
|
| 900 |
col.write(list_images[ind_col+2], use_column_width=True)
|
| 901 |
st.session_state.columns_size = columns_size
|
|
@@ -920,7 +920,25 @@ def app():
|
|
| 920 |
###
|
| 921 |
def raz():
|
| 922 |
st.session_state.list_coordinates = []
|
| 923 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 924 |
|
| 925 |
|
| 926 |
##----------- Initializations ---------------------------------------------------------------------
|
|
@@ -1151,7 +1169,7 @@ def app():
|
|
| 1151 |
if 'columns_size' not in st.session_state:
|
| 1152 |
st.session_state.columns_size = [2] + [1 for x in reader_type_list[1:]]
|
| 1153 |
if 'column_width' not in st.session_state:
|
| 1154 |
-
st.session_state.column_width = [
|
| 1155 |
if 'columns_color' not in st.session_state:
|
| 1156 |
st.session_state.columns_color = ["rgb(228,26,28)"] + \
|
| 1157 |
["rgb(0,0,0)" for x in reader_type_list[1:]]
|
|
@@ -1175,7 +1193,7 @@ def app():
|
|
| 1175 |
col.markdown(column_title, unsafe_allow_html=True)
|
| 1176 |
if isinstance(list_images[no_col+2], PIL.Image.Image):
|
| 1177 |
col.image(list_images[no_col+2], width=st.session_state.column_width[no_col], \
|
| 1178 |
-
|
| 1179 |
list_ok_detect.append(reader_type_list[no_col])
|
| 1180 |
else:
|
| 1181 |
col.write(list_images[no_col+2], use_column_width=True)
|
|
|
|
| 155 |
if 'columns_size' not in st.session_state:
|
| 156 |
st.session_state.columns_size = [2] + [1 for x in out_reader_type_list[1:]]
|
| 157 |
if 'column_width' not in st.session_state:
|
| 158 |
+
st.session_state.column_width = [400] + [300 for x in out_reader_type_list[1:]]
|
| 159 |
if 'columns_color' not in st.session_state:
|
| 160 |
st.session_state.columns_color = ["rgb(228,26,28)"] + \
|
| 161 |
["rgb(0,0,0)" for x in out_reader_type_list[1:]]
|
|
|
|
| 851 |
with show_reco.container():
|
| 852 |
# Draw the results, 2 images per line
|
| 853 |
reco_lines = math.ceil(len(in_reader_type_list) / 2)
|
| 854 |
+
column_width = 400
|
| 855 |
for ind_lig in range(0, reco_lines+1, 2):
|
| 856 |
cols = st.columns(2)
|
| 857 |
for ind_col in range(2):
|
|
|
|
| 882 |
"""
|
| 883 |
with show_detect.container():
|
| 884 |
columns_size = [1 for x in reader_type_list]
|
| 885 |
+
column_width = [300 for x in reader_type_list]
|
| 886 |
columns_color = ["rgb(0,0,0)" for x in reader_type_list]
|
| 887 |
columns_size[reader_type_dict[st.session_state.detect_reader]] = 2
|
| 888 |
+
column_width[reader_type_dict[st.session_state.detect_reader]] = 400
|
| 889 |
columns_color[reader_type_dict[st.session_state.detect_reader]] = "rgb(228,26,28)"
|
| 890 |
columns = st.columns(columns_size, ) #gap='medium')
|
| 891 |
|
|
|
|
| 895 |
col.markdown(column_title, unsafe_allow_html=True)
|
| 896 |
if isinstance(list_images[ind_col+2], PIL.Image.Image):
|
| 897 |
col.image(list_images[ind_col+2], width=column_width[ind_col], \
|
| 898 |
+
use_column_width=True)
|
| 899 |
else:
|
| 900 |
col.write(list_images[ind_col+2], use_column_width=True)
|
| 901 |
st.session_state.columns_size = columns_size
|
|
|
|
| 920 |
###
|
| 921 |
def raz():
|
| 922 |
st.session_state.list_coordinates = []
|
| 923 |
+
st.session_state.list_images = []
|
| 924 |
+
st.session_state.detect_reader = reader_type_list[0]
|
| 925 |
+
|
| 926 |
+
st.session_state.columns_size = [2] + [1 for x in reader_type_list[1:]]
|
| 927 |
+
st.session_state.column_width = [400] + [300 for x in reader_type_list[1:]]
|
| 928 |
+
st.session_state.columns_color = ["rgb(228,26,28)"] + \
|
| 929 |
+
["rgb(0,0,0)" for x in reader_type_list[1:]]
|
| 930 |
+
|
| 931 |
+
# Clear caches
|
| 932 |
+
easyocr_detect.clear()
|
| 933 |
+
ppocr_detect.clear()
|
| 934 |
+
mmocr_detect.clear()
|
| 935 |
+
tesserocr_detect.clear()
|
| 936 |
+
process_detect.clear()
|
| 937 |
+
get_cropped.clear()
|
| 938 |
+
easyocr_recog.clear()
|
| 939 |
+
ppocr_recog.clear()
|
| 940 |
+
mmocr_recog.clear()
|
| 941 |
+
tesserocr_recog.clear()
|
| 942 |
|
| 943 |
|
| 944 |
##----------- Initializations ---------------------------------------------------------------------
|
|
|
|
| 1169 |
if 'columns_size' not in st.session_state:
|
| 1170 |
st.session_state.columns_size = [2] + [1 for x in reader_type_list[1:]]
|
| 1171 |
if 'column_width' not in st.session_state:
|
| 1172 |
+
st.session_state.column_width = [400] + [300 for x in reader_type_list[1:]]
|
| 1173 |
if 'columns_color' not in st.session_state:
|
| 1174 |
st.session_state.columns_color = ["rgb(228,26,28)"] + \
|
| 1175 |
["rgb(0,0,0)" for x in reader_type_list[1:]]
|
|
|
|
| 1193 |
col.markdown(column_title, unsafe_allow_html=True)
|
| 1194 |
if isinstance(list_images[no_col+2], PIL.Image.Image):
|
| 1195 |
col.image(list_images[no_col+2], width=st.session_state.column_width[no_col], \
|
| 1196 |
+
use_column_width=True)
|
| 1197 |
list_ok_detect.append(reader_type_list[no_col])
|
| 1198 |
else:
|
| 1199 |
col.write(list_images[no_col+2], use_column_width=True)
|