Ujjwal123 commited on
Commit
d42572c
·
1 Parent(s): cb9e47a

ClueExtractionStatus changed to clueExtractionStatus

Browse files
Files changed (2) hide show
  1. extractpuzzle.py +3 -0
  2. main.py +2 -2
extractpuzzle.py CHANGED
@@ -642,6 +642,7 @@ def extract_grid(image):
642
  across_clue_num = []
643
  down_clue_num = []
644
 
 
645
  sorted_corners = np.array(list(sorted(harris_corners,key=lambda x:x[1])))
646
  if(len(sorted_corners) == len(averaged_horizontal_lines1) * len(averaged_vertical_lines1)):
647
  sorted_corners_grouped = []
@@ -665,6 +666,7 @@ def extract_grid(image):
665
  # if (x,y) is present in these array the cell (x,y) is already accounted as a part of answer of across or down
666
  in_horizontal = []
667
  in_vertical = []
 
668
 
669
  num = 0
670
 
@@ -765,6 +767,7 @@ def extract_grid(image):
765
  'cols' : len(averaged_vertical_lines1)-1,
766
  }
767
 
 
768
  dict = {
769
  'size' : size,
770
  'grid' : grid,
 
642
  across_clue_num = []
643
  down_clue_num = []
644
 
645
+ # extracting the grid color and filling up the grid variable
646
  sorted_corners = np.array(list(sorted(harris_corners,key=lambda x:x[1])))
647
  if(len(sorted_corners) == len(averaged_horizontal_lines1) * len(averaged_vertical_lines1)):
648
  sorted_corners_grouped = []
 
666
  # if (x,y) is present in these array the cell (x,y) is already accounted as a part of answer of across or down
667
  in_horizontal = []
668
  in_vertical = []
669
+
670
 
671
  num = 0
672
 
 
767
  'cols' : len(averaged_vertical_lines1)-1,
768
  }
769
 
770
+
771
  dict = {
772
  'size' : size,
773
  'grid' : grid,
main.py CHANGED
@@ -67,9 +67,9 @@ async def upload(file: UploadFile = File(...)):
67
  acrossClues, downClues = get_text(img_array) # { number : [column_of_projection_profile,extracted_text]}
68
  clue_data['clues']['across'] = changeClueFormat(acrossClues)
69
  clue_data['clues']['down'] = changeClueFormat(downClues)
70
- grid_data['ClueExtractionStatus'] = "Passed"
71
  except Exception as e:
72
- grid_data['ClueExtractionStatus'] = "Failed"
73
 
74
  grid_data['parsedFromImage'] = "True"
75
  grid_data.update(clue_data)
 
67
  acrossClues, downClues = get_text(img_array) # { number : [column_of_projection_profile,extracted_text]}
68
  clue_data['clues']['across'] = changeClueFormat(acrossClues)
69
  clue_data['clues']['down'] = changeClueFormat(downClues)
70
+ grid_data['clueExtractionStatus'] = "Passed"
71
  except Exception as e:
72
+ grid_data['clueExtractionStatus'] = "Failed"
73
 
74
  grid_data['parsedFromImage'] = "True"
75
  grid_data.update(clue_data)