Commit
·
56ce5ee
1
Parent(s):
bc634a9
Print acc
Browse files
app.py
CHANGED
@@ -349,12 +349,13 @@ async def detect_animals(file: UploadFile = File(...)):
|
|
349 |
api_url=os.getenv("ROBOFLOW_KEY", "")
|
350 |
)
|
351 |
for pred in fish_response.get("predictions", []):
|
352 |
-
if pred["confidence"] >= 0.
|
|
|
353 |
x1 = int(pred["x"] - pred["width"] / 2)
|
354 |
y1 = int(pred["y"] - pred["height"] / 2)
|
355 |
x2 = int(pred["x"] + pred["width"] / 2)
|
356 |
y2 = int(pred["y"] + pred["height"] / 2)
|
357 |
-
detections.append(((x1, y1, x2, y2), "Fish Alert"))
|
358 |
except Exception as e:
|
359 |
print("[Roboflow Fish Error]", e)
|
360 |
|
@@ -367,12 +368,13 @@ async def detect_animals(file: UploadFile = File(...)):
|
|
367 |
api_url=os.getenv("ROBOFLOW_KEY", "")
|
368 |
)
|
369 |
for pred in bird_response.get("predictions", []):
|
370 |
-
if pred["confidence"] >= 0.
|
|
|
371 |
x1 = int(pred["x"] - pred["width"] / 2)
|
372 |
y1 = int(pred["y"] - pred["height"] / 2)
|
373 |
x2 = int(pred["x"] + pred["width"] / 2)
|
374 |
y2 = int(pred["y"] + pred["height"] / 2)
|
375 |
-
detections.append(((x1, y1, x2, y2), "Bird Alert"))
|
376 |
except Exception as e:
|
377 |
print("[Roboflow Bird Error]", e)
|
378 |
|
|
|
349 |
api_url=os.getenv("ROBOFLOW_KEY", "")
|
350 |
)
|
351 |
for pred in fish_response.get("predictions", []):
|
352 |
+
if pred["confidence"] >= 0.70:
|
353 |
+
acc = pred["confidence"]
|
354 |
x1 = int(pred["x"] - pred["width"] / 2)
|
355 |
y1 = int(pred["y"] - pred["height"] / 2)
|
356 |
x2 = int(pred["x"] + pred["width"] / 2)
|
357 |
y2 = int(pred["y"] + pred["height"] / 2)
|
358 |
+
detections.append(((x1, y1, x2, y2), f"Fish Alert {acc}"))
|
359 |
except Exception as e:
|
360 |
print("[Roboflow Fish Error]", e)
|
361 |
|
|
|
368 |
api_url=os.getenv("ROBOFLOW_KEY", "")
|
369 |
)
|
370 |
for pred in bird_response.get("predictions", []):
|
371 |
+
if pred["confidence"] >= 0.70:
|
372 |
+
acc = pred["confidence"]
|
373 |
x1 = int(pred["x"] - pred["width"] / 2)
|
374 |
y1 = int(pred["y"] - pred["height"] / 2)
|
375 |
x2 = int(pred["x"] + pred["width"] / 2)
|
376 |
y2 = int(pred["y"] + pred["height"] / 2)
|
377 |
+
detections.append(((x1, y1, x2, y2), f"Bird Alert {acc}"))
|
378 |
except Exception as e:
|
379 |
print("[Roboflow Bird Error]", e)
|
380 |
|