Spaces:
Sleeping
Sleeping
Add different choices for input picture
Browse files- img.png +0 -0
- pages/About.py +3 -2
- pages/App.py +11 -9
img.png
ADDED
|
pages/About.py
CHANGED
|
@@ -6,13 +6,14 @@ st.write("")
|
|
| 6 |
st.write("")
|
| 7 |
st.write("")
|
| 8 |
|
| 9 |
-
st.markdown("##### This app allows you to compare, from a given
|
| 10 |
st.markdown("##### *EasyOcr, PaddleOCR, MMOCR, Tesseract*")
|
| 11 |
st.write("")
|
| 12 |
st.write("")
|
| 13 |
|
| 14 |
st.markdown(''' The 1st step is to choose the language for the text recognition (not all solutions \
|
| 15 |
-
support the same languages), and then
|
|
|
|
| 16 |
It is then possible to change the default values for the text area detection process, \
|
| 17 |
before launching the detection task for each solution.''')
|
| 18 |
st.write("")
|
|
|
|
| 6 |
st.write("")
|
| 7 |
st.write("")
|
| 8 |
|
| 9 |
+
st.markdown("##### This app allows you to compare, from a given picture, the results of different solutions:")
|
| 10 |
st.markdown("##### *EasyOcr, PaddleOCR, MMOCR, Tesseract*")
|
| 11 |
st.write("")
|
| 12 |
st.write("")
|
| 13 |
|
| 14 |
st.markdown(''' The 1st step is to choose the language for the text recognition (not all solutions \
|
| 15 |
+
support the same languages), and then choose the picture to consider. It is possible to upload a file, \
|
| 16 |
+
to take a picture, or to use a demo file. \
|
| 17 |
It is then possible to change the default values for the text area detection process, \
|
| 18 |
before launching the detection task for each solution.''')
|
| 19 |
st.write("")
|
pages/App.py
CHANGED
|
@@ -934,19 +934,21 @@ mmocr_lang = list_dict_lang[2][mmocr_key_lang]
|
|
| 934 |
tesserocr_key_lang = lang_col[3].selectbox(reader_type_list[3]+" :", list_dict_lang[3].keys(), 35)
|
| 935 |
tesserocr_lang = list_dict_lang[3][tesserocr_key_lang]
|
| 936 |
|
| 937 |
-
|
|
|
|
|
|
|
| 938 |
|
| 939 |
if img_typ == 'Upload file':
|
| 940 |
-
image_file =
|
| 941 |
if img_typ == 'Take a picture':
|
| 942 |
-
image_file =
|
| 943 |
if img_typ == 'Use a demo file':
|
| 944 |
-
|
| 945 |
-
demo_used =
|
| 946 |
-
|
| 947 |
-
|
| 948 |
-
|
| 949 |
-
|
| 950 |
if demo_used == 'File 1':
|
| 951 |
image_file = 'img_demo_1.jpg'
|
| 952 |
else:
|
|
|
|
| 934 |
tesserocr_key_lang = lang_col[3].selectbox(reader_type_list[3]+" :", list_dict_lang[3].keys(), 35)
|
| 935 |
tesserocr_lang = list_dict_lang[3][tesserocr_key_lang]
|
| 936 |
|
| 937 |
+
st.markdown("#### Choose picture:")
|
| 938 |
+
cols_pict = st.columns([1, 1, 2, 2])
|
| 939 |
+
img_typ = cols_pict[0].radio("", ['Upload file', 'Take a picture', 'Use a demo file'], index=0)
|
| 940 |
|
| 941 |
if img_typ == 'Upload file':
|
| 942 |
+
image_file = cols_pict[2].file_uploader("Upload a file:", type=["png","jpg","jpeg"])
|
| 943 |
if img_typ == 'Take a picture':
|
| 944 |
+
image_file = cols_pict[2].camera_input("Take a picture:")
|
| 945 |
if img_typ == 'Use a demo file':
|
| 946 |
+
cols_pict[1].markdown('###### Choose a demo file:')
|
| 947 |
+
demo_used = cols_pict[1].radio('', ['File 1', 'File 2'], index=0)
|
| 948 |
+
cols_pict[2].markdown('###### File 1')
|
| 949 |
+
cols_pict[2].image(img_demo_1, use_column_width=True)
|
| 950 |
+
cols_pict[3].markdown('###### File 2')
|
| 951 |
+
cols_pict[3].image(img_demo_2, use_column_width=True)
|
| 952 |
if demo_used == 'File 1':
|
| 953 |
image_file = 'img_demo_1.jpg'
|
| 954 |
else:
|