Skip to content

Commit e9d2787

Browse files
committed
fixed typeErrors
1 parent 1c57636 commit e9d2787

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/App.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Import dependencies
2-
import React, { useRef, useEffect, useState } from "react";
2+
import { useRef, useEffect, useState } from "react";
33
import Webcam from "react-webcam";
44
import * as tf from "@tensorflow/tfjs";
55
//import * as cpu from "@tensorflow/tfjs-backend-cpu";
@@ -10,8 +10,8 @@ import { drawRect } from "./utilities";
1010

1111
function App() {
1212
const [isLoading, setIsLoading]=useState(true)
13-
const webcamRef = useRef(null);
14-
const canvasRef = useRef(null);
13+
const webcamRef:any = useRef(null);
14+
const canvasRef:any = useRef(null);
1515

1616
tf.setBackend("webgl");
1717
// Main function
@@ -25,15 +25,15 @@ function App() {
2525
}, 10);
2626
};
2727

28-
const detect = async (net) => {
28+
const detect = async (net:any) => {
2929
// Check data is available
3030
if (
3131
typeof webcamRef.current !== "undefined" &&
3232
webcamRef.current !== null &&
3333
webcamRef.current.video.readyState === 4
3434
) {
3535
// Get Video Properties
36-
const video = webcamRef.current.video;
36+
const video:any = webcamRef.current.video;
3737
const videoWidth = webcamRef.current.video.videoWidth;
3838
const videoHeight = webcamRef.current.video.videoHeight;
3939

@@ -62,7 +62,7 @@ function App() {
6262
<>
6363
{isLoading&&isLoading?(
6464
<div style={{display:"flex",justifyContent:"center", background:"#252525", alignItems:"center", height:"100vh"}}>
65-
<p style={{text:"14px", color:"white"}}>Loading, please wait...</p>
65+
<p style={{fontSize:14, color:"white"}}>Loading, please wait...</p>
6666
</div>
6767
):(
6868
<div className="App">
@@ -77,7 +77,7 @@ function App() {
7777
left: 0,
7878
right: 0,
7979
textAlign: "center",
80-
zindex: 9,
80+
zIndex: 9,
8181
width: "100vw",
8282
height: "100vh",
8383
}}
@@ -92,7 +92,7 @@ function App() {
9292
left: 0,
9393
right: 0,
9494
textAlign: "center",
95-
zindex: 8,
95+
zIndex: 8,
9696
width: "100vw",
9797
height: "100vh",
9898
}}

src/utilities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
export const drawRect = (detections, ctx) =>{
2+
export const drawRect = (detections:any, ctx:any) =>{
33
// Loop through each prediction
4-
detections.forEach(prediction => {
4+
detections.forEach((prediction:any) => {
55

66
// Extract boxes and classes
77
const [x, y, width, height] = prediction['bbox'];

0 commit comments

Comments
 (0)