srijaydeshpande commited on
Commit
7179638
·
verified ·
1 Parent(s): 5be688b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -39,12 +39,15 @@ if file is not None:
39
  # collect the results in the dictionary:
40
  textdic_easyocr = {}
41
  for idx in range(len(result)):
42
- pred_coor = result[idx][0]
 
 
 
43
  pred_text = result[idx][1]
44
  pred_confidence = result[idx][2]
45
- if(pred_confidence>0.6):
46
  textdic_easyocr[pred_text] = {}
47
- textdic_easyocr[pred_text]['location'] = pred_coor
48
  textdic_easyocr[pred_text]['pred_confidence'] = pred_confidence
49
 
50
  # create a data frame which shows the predicted text and prediction confidence
 
39
  # collect the results in the dictionary:
40
  textdic_easyocr = {}
41
  for idx in range(len(result)):
42
+ x_coords = [point[0] for point in pred_coor]
43
+ y_coords = [point[1] for point in pred_coor]
44
+ center_x = sum(x_coords) / len(x_coords)
45
+ center_y = sum(y_coords) / len(y_coords)
46
  pred_text = result[idx][1]
47
  pred_confidence = result[idx][2]
48
+ if(pred_confidence>0.3):
49
  textdic_easyocr[pred_text] = {}
50
+ textdic_easyocr[pred_text]['location'] = (center_x, center_y)
51
  textdic_easyocr[pred_text]['pred_confidence'] = pred_confidence
52
 
53
  # create a data frame which shows the predicted text and prediction confidence