-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
44 lines (40 loc) · 1.65 KB
/
Copy pathindex.html
File metadata and controls
44 lines (40 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gesture Recognition</title>
<script>
async function fetchGestureData() {
try {
const response = await fetch('/gesture_data');
const data = await response.json();
const gestureList = document.getElementById('gestureList');
gestureList.innerHTML = '';
if (data.gestures.length > 0) {
data.gestures.forEach((hand, index) => {
const handElement = document.createElement('div');
handElement.innerHTML = `<strong>Hand ${index + 1} (${hand.handedness}):</strong><br>`;
hand.gestures.forEach(gesture => {
handElement.innerHTML += `Gesture: ${gesture.gesture} (Score: ${gesture.score.toFixed(2)})<br>`;
});
gestureList.appendChild(handElement);
});
} else {
gestureList.innerHTML = 'No gestures detected.';
}
} catch (error) {
console.error('Error fetching gesture data:', error);
}
}
// Fetch gesture data every second
setInterval(fetchGestureData, 1000);
</script>
</head>
<body>
<h1>Gesture Recognition</h1>
<img src="{{ url_for('video_feed') }}" width="640" height="480" />
<h2>Gesture Data</h2>
<div id="gestureList">Fetching gesture data...</div>
</body>
</html>