DHEIVER commited on
Commit
23fe0a8
·
1 Parent(s): 57e8470

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -64,13 +64,17 @@ def classify_image(input_image):
64
  cv2.putText(output_image, f"Analysis Time: {current_time.strftime('%Y-%m-%d %H:%M:%S')}", (10, output_image.shape[0] - 30), font, font_scale, (0, 0, 0), 1)
65
  cv2.putText(output_image, f"Predicted Class: {predicted_class}", (10, output_image.shape[0] - 10), font, font_scale, (0, 0, 0), 1) # Cor preta
66
 
67
- # Desenhe uma caixa de identificação de objeto (por exemplo, retângulo vermelho)
68
- # Você pode ajustar as coordenadas (x, y, largura, altura) conforme necessário
69
- object_box_color = (0, 0, 255) # Vermelho (BGR)
70
- cv2.rectangle(output_image, (50, 50), (150, 150), object_box_color, 2) # Exemplo de caixa
 
71
 
72
- return output_image
 
 
73
 
 
74
 
75
  # Crie uma interface Gradio
76
  input_interface = gr.Interface(
 
64
  cv2.putText(output_image, f"Analysis Time: {current_time.strftime('%Y-%m-%d %H:%M:%S')}", (10, output_image.shape[0] - 30), font, font_scale, (0, 0, 0), 1)
65
  cv2.putText(output_image, f"Predicted Class: {predicted_class}", (10, output_image.shape[0] - 10), font, font_scale, (0, 0, 0), 1) # Cor preta
66
 
67
+ # Calcule as coordenadas para centralizar a caixa azul no centro da imagem
68
+ image_height, image_width, _ = output_image.shape
69
+ box_size = 100 # Tamanho da caixa azul (ajuste conforme necessário)
70
+ box_x = (image_width - box_size) // 2
71
+ box_y = (image_height - box_size) // 2
72
 
73
+ # Desenhe uma caixa de identificação de objeto (retângulo azul) centralizada
74
+ object_box_color = (255, 0, 0) # Azul (BGR)
75
+ cv2.rectangle(output_image, (box_x, box_y), (box_x + box_size, box_y + box_size), object_box_color, 2) # Caixa centralizada
76
 
77
+ return output_image
78
 
79
  # Crie uma interface Gradio
80
  input_interface = gr.Interface(