Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
#
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
| 71 |
|
| 72 |
-
|
|
|
|
|
|
|
| 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(
|