Spaces:
Build error
Build error
Fix app.py
Browse files
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 |
-
|
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 |
-
|
236 |
-
|
237 |
|
238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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__':
|