diff --git a/backend/core/serializers.py b/backend/core/serializers.py
index 0a687f9e..3d9cb7bf 100644
--- a/backend/core/serializers.py
+++ b/backend/core/serializers.py
@@ -110,12 +110,18 @@ class PredictionParamSerializer(serializers.Serializer):
bbox = serializers.ListField(child=serializers.FloatField(), required=True)
model_id = serializers.IntegerField(required=True)
zoom_level = serializers.IntegerField(required=True)
+ confidence = serializers.IntegerField(required=False)
source = serializers.URLField(required=False)
def validate(self, data):
"""
Check supplied data
"""
+ if "confidence" in data:
+ if data["confidence"] < 0 or data["confidence"] > 100:
+ raise serializers.ValidationError(
+ f"""Invalid Confidence threshold : {data["confidence"]}, Should be between 0-100"""
+ )
if len(data["bbox"]) != 4:
raise serializers.ValidationError("Not a valid bbox")
if data["zoom_level"] < 18 or data["zoom_level"] > 22:
diff --git a/backend/core/views.py b/backend/core/views.py
index 932302a1..d1c3bc72 100644
--- a/backend/core/views.py
+++ b/backend/core/views.py
@@ -377,6 +377,9 @@ def post(self, request, *args, **kwargs):
model_path,
temp_path,
prediction_output,
+ deserialized_data["confidence"] / 100
+ if "confidence" in deserialized_data
+ else 0.5,
)
future.result(
timeout=45
diff --git a/frontend/src/components/Layout/Start/Prediction/Prediction.js b/frontend/src/components/Layout/Start/Prediction/Prediction.js
index e0245427..259329f7 100644
--- a/frontend/src/components/Layout/Start/Prediction/Prediction.js
+++ b/frontend/src/components/Layout/Start/Prediction/Prediction.js
@@ -8,6 +8,14 @@ import {
Paper,
Typography,
} from "@mui/material";
+import {
+ FormControl,
+ InputLabel,
+ Tooltip,
+ MenuItem,
+ Select,
+} from "@mui/material";
+
import React, { useContext, useEffect, useRef, useState } from "react";
import {
FeatureGroup,
@@ -28,6 +36,7 @@ const Prediction = () => {
const [josmLoading, setJosmLoading] = useState(false);
const [apiCallInProgress, setApiCallInProgress] = useState(false);
+ const [confidence, setConfidence] = useState(50);
const [map, setMap] = useState(null);
const [zoom, setZoom] = useState(0);
@@ -177,6 +186,7 @@ const Prediction = () => {
model_id: id,
zoom_level: zoom,
source: dataset.source_imagery,
+ confidence: confidence,
};
const startTime = new Date().getTime(); // measure start time
const res = await axios.post(`/prediction/`, body, { headers });
@@ -311,13 +321,36 @@ const Prediction = () => {
>
Run Prediction
+
+
+
+ Confidence:
+
+
+
+
+
+
{map && (
-
-
- Current Zoom: {JSON.stringify(zoom)}
+
+
+ Current Zoom: {JSON.stringify(zoom)}
+
+
+ Response: {responseTime} sec
- Response: {responseTime} sec
{loading ? (