Loren commited on
Commit
ce66da9
·
1 Parent(s): 75a3180

Add pick color

Browse files
Files changed (1) hide show
  1. pages/App.py +6 -6
pages/App.py CHANGED
@@ -256,7 +256,7 @@ def load_image(in_image_file):
256
  in_image_file (string or Streamlit UploadedFile): image to consider
257
 
258
  Returns:
259
- string : locally saved image path
260
  PIL.Image : input file opened with Pillow
261
  matrix : input file opened with Opencv
262
  """
@@ -267,9 +267,9 @@ def load_image(in_image_file):
267
  # out_image_path = "img."+in_image_file.name.split('.')[-1]
268
 
269
  if isinstance(in_image_file, str):
270
- out_image_path = "wrk_"+in_image_file
271
  else:
272
- out_image_path = "wrk_"+in_image_file.name
273
 
274
  img = Image.open(in_image_file)
275
  img_saved = img.save(out_image_path)
@@ -778,7 +778,7 @@ def tesserocr_recog(in_img, in_params, in_nb_images):
778
  ###
779
  def draw_reco_images(in_image, in_boxes_coordinates, in_list_texts, in_list_confid, \
780
  in_dict_back_colors, in_df_results_tesseract, in_reader_type_list, \
781
- in_font_scale=3, in_conf_threshold=65):
782
  """Draw recognized text on original image, for each OCR solution used
783
 
784
  Args:
@@ -1099,7 +1099,7 @@ Use rectlar box to calculate faster, and polygonal box more accurate for curved
1099
  placeholder='Limit tesseract to recognize only this characters', \
1100
  help='Example for numbers only : 0123456789')
1101
 
1102
- color_hex = col2.color_picker('Pick a color for boxes outlines', '#004C99')
1103
  color_part = color_hex.lstrip('#')
1104
  color = tuple(int(color_part[i:i+2], 16) for i in (0, 2, 4))
1105
 
@@ -1358,7 +1358,7 @@ Use rectlar box to calculate faster, and polygonal box more accurate for curved
1358
 
1359
  col_font, col_threshold = st.columns(2)
1360
 
1361
- col_font.slider('Font scale', 1, 7, 4, step=1, key="font_scale_sld")
1362
  col_threshold.slider('% confidence threshold for text color change', 40, 100, 64, \
1363
  step=1, key="conf_threshold_sld")
1364
  col_threshold.write("(text color is black below this % confidence threshold, \
 
256
  in_image_file (string or Streamlit UploadedFile): image to consider
257
 
258
  Returns:
259
+ string : locally saved image path (img.)
260
  PIL.Image : input file opened with Pillow
261
  matrix : input file opened with Opencv
262
  """
 
267
  # out_image_path = "img."+in_image_file.name.split('.')[-1]
268
 
269
  if isinstance(in_image_file, str):
270
+ out_image_path = "tmp/wrk_"+in_image_file
271
  else:
272
+ out_image_path = "tmp/wrk_"+in_image_file.name
273
 
274
  img = Image.open(in_image_file)
275
  img_saved = img.save(out_image_path)
 
778
  ###
779
  def draw_reco_images(in_image, in_boxes_coordinates, in_list_texts, in_list_confid, \
780
  in_dict_back_colors, in_df_results_tesseract, in_reader_type_list, \
781
+ in_font_scale=1, in_conf_threshold=65):
782
  """Draw recognized text on original image, for each OCR solution used
783
 
784
  Args:
 
1099
  placeholder='Limit tesseract to recognize only this characters', \
1100
  help='Example for numbers only : 0123456789')
1101
 
1102
+ color_hex = col2.color_picker('Set a color for box outlines:', '#004C99')
1103
  color_part = color_hex.lstrip('#')
1104
  color = tuple(int(color_part[i:i+2], 16) for i in (0, 2, 4))
1105
 
 
1358
 
1359
  col_font, col_threshold = st.columns(2)
1360
 
1361
+ col_font.slider('Font scale', 1, 7, 1, step=1, key="font_scale_sld")
1362
  col_threshold.slider('% confidence threshold for text color change', 40, 100, 64, \
1363
  step=1, key="conf_threshold_sld")
1364
  col_threshold.write("(text color is black below this % confidence threshold, \