diff --git a/app/frontend/src/api/modelsDeployedApis.ts b/app/frontend/src/api/modelsDeployedApis.ts index 49e5771f..b1314967 100644 --- a/app/frontend/src/api/modelsDeployedApis.ts +++ b/app/frontend/src/api/modelsDeployedApis.ts @@ -168,7 +168,7 @@ export const handleModelNavigationClick = ( const destination = getDestinationFromModelType(modelType); console.log(`${modelType} button clicked for model: ${modelID}`); console.log(`Opening ${modelType} for model: ${modelName}`); - customToast.success(`${destination} page opened!`); + customToast.success(`${destination.slice(1)} page opened!`); navigate(destination, { state: { containerID: modelID, modelName: modelName }, diff --git a/app/frontend/src/components/object_detection/ObjectDetectionComponent.tsx b/app/frontend/src/components/object_detection/ObjectDetectionComponent.tsx index d5c9b23b..d8a79598 100644 --- a/app/frontend/src/components/object_detection/ObjectDetectionComponent.tsx +++ b/app/frontend/src/components/object_detection/ObjectDetectionComponent.tsx @@ -132,7 +132,7 @@ export const ObjectDetectionComponent: React.FC = () => {
Input image width and height: {metadata.width} x {metadata.height}
- Time to inference: {metadata.inferenceTime} sec + Frame Rate: {metadata.inferenceTime} FPS
)} diff --git a/app/frontend/src/components/object_detection/utlis/runInference.ts b/app/frontend/src/components/object_detection/utlis/runInference.ts index d2bcc409..bb5d3a09 100644 --- a/app/frontend/src/components/object_detection/utlis/runInference.ts +++ b/app/frontend/src/components/object_detection/utlis/runInference.ts @@ -23,6 +23,7 @@ export const runInference = async ( } try { + const startTime = performance.now(); const response = await axios.post( `/models-api/object-detection/`, formData, @@ -30,6 +31,8 @@ export const runInference = async ( headers: { "Content-Type": "multipart/form-data" }, }, ); + const endTime = performance.now(); + const requestLatency = endTime - startTime; // handle imageSourceElement types let width, height; if (imageSourceElement instanceof HTMLCanvasElement) { @@ -42,7 +45,7 @@ export const runInference = async ( const detectionMetadata: DetectionMetadata = { width: width, height: height, - inferenceTime: response.data.inference_time || 33.333, + inferenceTime: response.data.inference_time || (1/(requestLatency/1000)).toFixed(2), }; const detections: Detection[] = response.data.map( // eslint-disable-next-line @typescript-eslint/no-explicit-any