ethanrom commited on
Commit
2d012f9
·
1 Parent(s): 397c146

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -17
app.py CHANGED
@@ -1,5 +1,4 @@
1
  import streamlit as st
2
- #from button_click import find_order_id
3
  import tensorflow as tf
4
  from button_click_alt import find_order_id
5
 
@@ -8,22 +7,29 @@ def main():
8
  st.title('OCR + Font type demo')
9
  st.write('intro')
10
 
11
- with st.sidebar:
12
- st.write('## Input')
13
- uploaded_file = st.file_uploader('Upload the image file (PNG or JPG)', type=['png', 'jpg'], help='help')
14
- input_file = st.file_uploader('Upload the input file (TXT)', type=['txt'], help='help')
15
- ocre = st.selectbox('OCR Engine', ['Hive', 'Tesseract'])
16
- img_processing = st.selectbox('Image preprocessing', ['Gray Scaling', 'Thresholding, Denoising, Binarization, Skew Correction', 'Adaptive Thresholding, Morphological Operations, CCA'])
17
- cnn_model = st.selectbox('Neural Network Model', ['CNN-MaxPool-Dense-Dropout', 'BatchNorm-CNN-MaxPool-Dense-Dropout'])
18
-
19
- if st.button('Find Order ID') and uploaded_file and input_file:
20
- st.write('## Output')
21
- model = tf.keras.models.load_model('model.h5')
22
- result = find_order_id(uploaded_file, input_file, model, ocre)
23
- if result['status'] == 'success':
24
- st.success(result['message'])
25
- elif result['status'] == 'warning':
26
- st.warning(result['message'])
 
 
 
 
 
 
 
27
 
28
  if __name__ == '__main__':
29
  main()
 
1
  import streamlit as st
 
2
  import tensorflow as tf
3
  from button_click_alt import find_order_id
4
 
 
7
  st.title('OCR + Font type demo')
8
  st.write('intro')
9
 
10
+ tabs = ['Find Order ID', 'About']
11
+ selected_tab = st.radio('Select Tab', tabs)
12
+
13
+ if selected_tab == 'Find Order ID':
14
+ with st.expander('Input'):
15
+ uploaded_file = st.file_uploader('Upload the image file (PNG or JPG)', type=['png', 'jpg'], help='help')
16
+ input_file = st.file_uploader('Upload the input file (TXT)', type=['txt'], help='help')
17
+ ocre = st.selectbox('OCR Engine', ['Hive', 'Tesseract'])
18
+ img_processing = st.selectbox('Image preprocessing', ['Gray Scaling', 'Thresholding, Denoising, Binarization, Skew Correction', 'Adaptive Thresholding, Morphological Operations, CCA'])
19
+ cnn_model = st.selectbox('Neural Network Model', ['CNN-MaxPool-Dense-Dropout', 'BatchNorm-CNN-MaxPool-Dense-Dropout'])
20
+
21
+ if st.button('Find Order ID') and uploaded_file and input_file:
22
+ with st.expander('Output'):
23
+ model = tf.keras.models.load_model('model.h5')
24
+ result = find_order_id(uploaded_file, input_file, model, ocre)
25
+ if result['status'] == 'success':
26
+ st.success(result['message'])
27
+ elif result['status'] == 'warning':
28
+ st.warning(result['message'])
29
+
30
+ elif selected_tab == 'About':
31
+ st.subheader('About this app')
32
+ st.write('This app is designed to demonstrate OCR and font type identification using deep learning models. It allows you to upload an image file and a text file containing the font type, and it will attempt to extract the order ID from the image using OCR and deep learning models.')
33
 
34
  if __name__ == '__main__':
35
  main()