Piarasingh85 commited on
Commit
e2d94bd
·
verified ·
1 Parent(s): 864dc88

Create index.html

Browse files
Files changed (1) hide show
  1. index.html +31 -0
index.html ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Live Feed with Hugging Face</title>
5
+ </head>
6
+ <body>
7
+ <video id="video" width="640" height="480" autoplay></video>
8
+ <script>
9
+ const video = document.getElementById('video');
10
+
11
+ const ws = new WebSocket("ws://localhost:8000/ws");
12
+
13
+ ws.onmessage = function(event) {
14
+ const predictions = JSON.parse(event.data);
15
+ console.log(predictions);
16
+ // Process predictions to draw bounding boxes, etc.
17
+ };
18
+
19
+ // This part is to display the live video feed
20
+ if (navigator.mediaDevices.getUserMedia) {
21
+ navigator.mediaDevices.getUserMedia({ video: true })
22
+ .then(function(stream) {
23
+ video.srcObject = stream;
24
+ })
25
+ .catch(function(error) {
26
+ console.log("Something went wrong!");
27
+ });
28
+ }
29
+ </script>
30
+ </body>
31
+ </html>