DHEIVER commited on
Commit
aaa7fbe
1 Parent(s): 3639873

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -40,13 +40,19 @@ def classify_image(input_image):
40
  output_image = (input_image[0] * 255).astype('uint8')
41
  output_image_with_box = output_image.copy()
42
 
43
- # Desenhe uma caixa de identifica莽茫o de objeto no output_image_with_box (apenas como exemplo)
44
  if predicted_class == "Cataract": # Adicione sua l贸gica para desenhar a caixa com base na classe
45
- cv2.rectangle(output_image_with_box, (50, 50), (150, 150), (0, 255, 0), 2) # Exemplo de caixa verde
 
 
 
 
 
 
46
 
47
- # Escreva o r贸tulo de previs茫o no output_image_with_box
48
  font = cv2.FONT_HERSHEY_SIMPLEX
49
- cv2.putText(output_image_with_box, f"Predicted Class: {predicted_class}", (10, 30), font, 0.7, (0, 0, 255), 2)
50
 
51
  return output_image_with_box
52
 
 
40
  output_image = (input_image[0] * 255).astype('uint8')
41
  output_image_with_box = output_image.copy()
42
 
43
+ # Desenhe uma caixa de identifica莽茫o de objeto no output_image_with_box (centralizada)
44
  if predicted_class == "Cataract": # Adicione sua l贸gica para desenhar a caixa com base na classe
45
+ image_height, image_width, _ = output_image.shape
46
+ box_size = min(image_height, image_width) // 3
47
+ x1 = (image_width - box_size) // 2
48
+ y1 = (image_height - box_size) // 2
49
+ x2 = x1 + box_size
50
+ y2 = y1 + box_size
51
+ cv2.rectangle(output_image_with_box, (x1, y1), (x2, y2), (0, 255, 0), 2) # Exemplo de caixa verde
52
 
53
+ # Escreva o r贸tulo de previs茫o no output_image_with_box (com fonte menor)
54
  font = cv2.FONT_HERSHEY_SIMPLEX
55
+ cv2.putText(output_image_with_box, f"Predicted Class: {predicted_class}", (10, 20), font, 0.5, (0, 0, 255), 2)
56
 
57
  return output_image_with_box
58