Spaces:
Runtime error
Runtime error
| <html> | |
| <head> | |
| <title>Live Feed with Hugging Face</title> | |
| </head> | |
| <body> | |
| <video id="video" width="640" height="480" autoplay></video> | |
| <script> | |
| const video = document.getElementById('video'); | |
| const ws = new WebSocket("ws://localhost:8000/ws"); | |
| ws.onmessage = function(event) { | |
| const predictions = JSON.parse(event.data); | |
| console.log(predictions); | |
| // Process predictions to draw bounding boxes, etc. | |
| }; | |
| // This part is to display the live video feed | |
| if (navigator.mediaDevices.getUserMedia) { | |
| navigator.mediaDevices.getUserMedia({ video: true }) | |
| .then(function(stream) { | |
| video.srcObject = stream; | |
| }) | |
| .catch(function(error) { | |
| console.log("Something went wrong!"); | |
| }); | |
| } | |
| </script> | |
| </body> | |
| </html> | |