MCPcopy Create free account
hub / github.com/expo/examples / useTensorFlowLoaded

Function useTensorFlowLoaded

with-tfjs-camera/src/useTensorFlow.js:26–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24}
25
26export function useTensorFlowLoaded() {
27 const [isLoaded, setLoaded] = React.useState(false);
28
29 React.useEffect(() => {
30 let isMounted = true;
31 tf.ready().then(() => {
32 if (isMounted) {
33 setLoaded(true);
34 }
35 });
36 return () => (isMounted = false);
37 }, []);
38
39 return isLoaded;
40}

Callers 1

AppFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected