bachpc commited on
Commit
188eda0
·
1 Parent(s): 65b03fb

Minor changes + fix bugs

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -211,7 +211,7 @@ def visualize_ocr(pil_img, ocr_result):
211
  text = result['text']
212
  rect = patches.Rectangle(bbox[:2], bbox[2]-bbox[0], bbox[3]-bbox[1], linewidth=2, edgecolor='red', facecolor='none', linestyle='-')
213
  ax.add_patch(rect)
214
- ax.text(bbox[2], bbox[3], text, horizontalalignment='left', verticalalignment='bottom', color='blue', fontsize=7)
215
 
216
  plt.xticks([], [])
217
  plt.yticks([], [])
@@ -300,11 +300,11 @@ def visualize_structure(pil_img, structure_result):
300
  for class_name in structure_class_names[:-1]:
301
  color, alpha, linewidth, hatch = get_bbox_decorations('recognition', structure_class_map[class_name])
302
  legend_elements.append(
303
- Patch(facecolor='none', edgecolor=color, linewidth=linewidth, linestyle='--', label=class_name, hatch=hatch)
304
  )
305
 
306
  plt.legend(handles=legend_elements, bbox_to_anchor=(0.5, -0.02), loc='upper center', borderaxespad=0,
307
- fontsize=10, ncol=6)
308
  plt.gcf().set_size_inches(10, 10)
309
  plt.axis('off')
310
  img_buf = io.BytesIO()
@@ -572,7 +572,6 @@ def main():
572
 
573
  st.set_page_config(layout='wide')
574
  st.title('Table Extraction Demo')
575
- st.write('\n')
576
 
577
  filename = st.file_uploader('Upload image', type=['png', 'jpeg', 'jpg'])
578
 
@@ -656,5 +655,6 @@ def main():
656
  st.subheader(f'HTML Table {idx + 1}')
657
  st.markdown(html_result, unsafe_allow_html=True)
658
 
 
659
  if __name__ == '__main__':
660
  main()
 
211
  text = result['text']
212
  rect = patches.Rectangle(bbox[:2], bbox[2]-bbox[0], bbox[3]-bbox[1], linewidth=2, edgecolor='red', facecolor='none', linestyle='-')
213
  ax.add_patch(rect)
214
+ ax.text(bbox[0], bbox[1], text, horizontalalignment='left', verticalalignment='bottom', color='blue', fontsize=7)
215
 
216
  plt.xticks([], [])
217
  plt.yticks([], [])
 
300
  for class_name in structure_class_names[:-1]:
301
  color, alpha, linewidth, hatch = get_bbox_decorations('recognition', structure_class_map[class_name])
302
  legend_elements.append(
303
+ Patch(facecolor=color, edgecolor=color, linestyle='--', label=class_name, hatch=hatch)
304
  )
305
 
306
  plt.legend(handles=legend_elements, bbox_to_anchor=(0.5, -0.02), loc='upper center', borderaxespad=0,
307
+ fontsize=10, ncol=3)
308
  plt.gcf().set_size_inches(10, 10)
309
  plt.axis('off')
310
  img_buf = io.BytesIO()
 
572
 
573
  st.set_page_config(layout='wide')
574
  st.title('Table Extraction Demo')
 
575
 
576
  filename = st.file_uploader('Upload image', type=['png', 'jpeg', 'jpg'])
577
 
 
655
  st.subheader(f'HTML Table {idx + 1}')
656
  st.markdown(html_result, unsafe_allow_html=True)
657
 
658
+
659
  if __name__ == '__main__':
660
  main()