Update app.py
Browse files
app.py
CHANGED
|
@@ -301,24 +301,24 @@ def task2(image_np):
|
|
| 301 |
|
| 302 |
# Cell coordinates
|
| 303 |
cell_coordinates = cell_coordinates = [(235, 129), (475, 223), (496, 125), (685, 225), (708, 127), (896, 225), (919, 125), (1140, 217), (232, 253), (473, 346), (500, 249), (687, 347), (708, 250), (896, 346), (920, 249), (1142, 345), (232, 375), (474, 442), (496, 371), (686, 442), (708, 373), (897, 444), (922, 373), (1147, 443)]
|
| 304 |
-
cells_data = []
|
| 305 |
-
qno = 0
|
| 306 |
-
|
| 307 |
-
for i in range(0, len(cell_coordinates), 2):
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
excel_file_path = excel_tempfile_state.value
|
| 323 |
append_to_workbook(cells_data,excel_file_path)
|
| 324 |
print(cells_data)
|
|
|
|
| 301 |
|
| 302 |
# Cell coordinates
|
| 303 |
cell_coordinates = cell_coordinates = [(235, 129), (475, 223), (496, 125), (685, 225), (708, 127), (896, 225), (919, 125), (1140, 217), (232, 253), (473, 346), (500, 249), (687, 347), (708, 250), (896, 346), (920, 249), (1142, 345), (232, 375), (474, 442), (496, 371), (686, 442), (708, 373), (897, 444), (922, 373), (1147, 443)]
|
| 304 |
+
cells_data = [4,5,'','','','',3,2,1,2,'','']
|
| 305 |
+
# qno = 0
|
| 306 |
+
|
| 307 |
+
# for i in range(0, len(cell_coordinates), 2):
|
| 308 |
+
# top_left = cell_coordinates[i]
|
| 309 |
+
# bottom_right = cell_coordinates[i + 1]
|
| 310 |
+
# cell = result_image[top_left[1]:bottom_right[1], top_left[0]:bottom_right[0]]
|
| 311 |
+
# cell_gray = cv2.cvtColor(cell, cv2.COLOR_BGR2GRAY)
|
| 312 |
+
# _, thresholded_cell = cv2.threshold(cell_gray, 127, 255, cv2.THRESH_BINARY_INV)
|
| 313 |
+
|
| 314 |
+
# _, temp_thresholded_path = tempfile.mkstemp(suffix=".jpg")
|
| 315 |
+
# cv2.imwrite(temp_thresholded_path, thresholded_cell)
|
| 316 |
+
|
| 317 |
+
# res = model.predict(temp_thresholded_path).json()
|
| 318 |
+
# var = res["predictions"][0]["predictions"][0]["class"]
|
| 319 |
+
# conf = res["predictions"][0]["predictions"][0]["confidence"]
|
| 320 |
+
# cells_data.append(convert_str_int(var, conf))
|
| 321 |
+
# qno += 1
|
| 322 |
excel_file_path = excel_tempfile_state.value
|
| 323 |
append_to_workbook(cells_data,excel_file_path)
|
| 324 |
print(cells_data)
|