added requirement
This commit is contained in:
@@ -10,4 +10,5 @@ pycocotools==2.0.11
|
|||||||
|
|
||||||
pydantic==2.13.3
|
pydantic==2.13.3
|
||||||
pydantic_core==2.46.3
|
pydantic_core==2.46.3
|
||||||
python-dotenv==1.2.2
|
python-dotenv==1.2.2
|
||||||
|
websockets==16.0
|
||||||
@@ -93,8 +93,31 @@ function Object_Detection() {
|
|||||||
}, "image/jpeg", 0.9);
|
}, "image/jpeg", 0.9);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const socket = new WebSocket("wss://api.marvinkrausser.com/predict_face");
|
||||||
|
|
||||||
setInterval(captureImage, 100);
|
socket.onopen = () => {
|
||||||
|
console.log("Connected");
|
||||||
|
socket.send("Hello server!");
|
||||||
|
};
|
||||||
|
|
||||||
|
socket.onmessage = (event) => {
|
||||||
|
setMessages((prev) => [...prev, event.data]);
|
||||||
|
};
|
||||||
|
|
||||||
|
socket.onerror = (err) => {
|
||||||
|
console.error("WebSocket error:", err);
|
||||||
|
};
|
||||||
|
|
||||||
|
socket.onclose = () => {
|
||||||
|
console.log("Disconnected");
|
||||||
|
};
|
||||||
|
|
||||||
|
// cleanup when component unmounts
|
||||||
|
return () => {
|
||||||
|
socket.close();
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='site-box'>
|
<div className='site-box'>
|
||||||
|
|||||||
Reference in New Issue
Block a user