3v324v23 commited on
Commit
4a9ef07
·
1 Parent(s): b3722f6
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. app.py +2 -2
  3. fonts/simfang.ttf +3 -0
  4. utils.py +5 -4
.gitattributes CHANGED
@@ -64,3 +64,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
64
  *.pdiparams filter=lfs diff=lfs merge=lfs -text
65
  *.info filter=lfs diff=lfs merge=lfs -text
66
  *.pdmodel filter=lfs diff=lfs merge=lfs -text
 
 
64
  *.pdiparams filter=lfs diff=lfs merge=lfs -text
65
  *.info filter=lfs diff=lfs merge=lfs -text
66
  *.pdmodel filter=lfs diff=lfs merge=lfs -text
67
+ *.ttf filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -16,7 +16,7 @@ uploaded_file = st.file_uploader("**Upload a Chest X-Ray Image**", type= ['png',
16
  if uploaded_file is not None:
17
  # Get actual image file
18
  fpath= get_image_path(uploaded_file)
19
- st.image(fpath)
20
  res = start_ocr({
21
  'image_dir': fpath,
22
  'drop_score': 0.3,
@@ -37,4 +37,4 @@ if uploaded_file is not None:
37
  "show_log": True,
38
  })
39
 
40
- st.write(json.dumps(res))
 
16
  if uploaded_file is not None:
17
  # Get actual image file
18
  fpath= get_image_path(uploaded_file)
19
+ # st.image(fpath)
20
  res = start_ocr({
21
  'image_dir': fpath,
22
  'drop_score': 0.3,
 
37
  "show_log": True,
38
  })
39
 
40
+ st.image(draw_ocr_results(fpath, res, './fonts/simfang.ttf'))
fonts/simfang.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:521c6f7546b4eb64fa4b0cd604bbd36333a20a57e388c8e2ad2ad07b9e593864
3
+ size 10576012
utils.py CHANGED
@@ -88,10 +88,11 @@ def draw_ocr_results(image_fp: Union[str, Path, Image.Image], ocr_outs, font_pat
88
 
89
  # cv2.imwrite(out_draw_fp, draw_img[:, :, ::-1])
90
 
91
- plt.figure(figsize=(draw_img.shape[0]/100, draw_img.shape[1]/100), dpi=100)
92
- plt.imshow(draw_img)
93
- plt.axis('off') # Turn off axis numbers
94
- plt.show()
 
95
 
96
  class MyObject:
97
  def __init__(self, dictionary):
 
88
 
89
  # cv2.imwrite(out_draw_fp, draw_img[:, :, ::-1])
90
 
91
+ #plt.figure(figsize=(draw_img.shape[0]/100, draw_img.shape[1]/100), dpi=100)
92
+ #plt.imshow(draw_img)
93
+ #plt.axis('off') # Turn off axis numbers
94
+ #plt.show()
95
+ return draw_img
96
 
97
  class MyObject:
98
  def __init__(self, dictionary):