pcback commited on
Commit
de2f578
1 Parent(s): 17c78a6

Fix app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -8
app.py CHANGED
@@ -225,17 +225,26 @@ def main():
225
  st.set_option('deprecation.showfileUploaderEncoding', False)
226
  filename = st.sidebar.file_uploader("Upload files", type=['png', 'jpeg', 'jpg'])
227
 
228
- cols[0].image(cv2.imread(filename))
229
 
230
- ocr_res = ocr(filename)
231
- structure_result = table_structure(filename)
232
- table_structures, cells, confidence_score = convert_stucture(ocr_res, filename, structure_result)
233
- visualize_cells(filename, cells, cols[1])
234
 
235
- cells = extract_text_from_cells(filename, cells)
236
- html_code = cells_to_html(cells)
237
 
238
- cols[2].html(html_code)
 
 
 
 
 
 
 
 
 
 
 
 
 
239
 
240
 
241
  if __name__ == '__main__':
 
225
  st.set_option('deprecation.showfileUploaderEncoding', False)
226
  filename = st.sidebar.file_uploader("Upload files", type=['png', 'jpeg', 'jpg'])
227
 
 
228
 
229
+ if st.sidebar.button("Analyze page"):
 
 
 
230
 
231
+ if filename is None:
232
+ st.sidebar.write("Please upload an image")
233
 
234
+ else:
235
+ print(filename)
236
+
237
+ cols[0].image(cv2.imread(filename))
238
+
239
+ ocr_res = ocr(filename)
240
+ structure_result = table_structure(filename)
241
+ table_structures, cells, confidence_score = convert_stucture(ocr_res, filename, structure_result)
242
+ visualize_cells(filename, cells, cols[1])
243
+
244
+ cells = extract_text_from_cells(filename, cells)
245
+ html_code = cells_to_html(cells)
246
+
247
+ cols[2].html(html_code)
248
 
249
 
250
  if __name__ == '__main__':