iyangcheng
commited on
use dataset API
Browse files- index.html +17 -34
index.html
CHANGED
@@ -61,14 +61,6 @@
|
|
61 |
Your browser does not support the video tag.
|
62 |
</video>
|
63 |
</div>
|
64 |
-
<!--
|
65 |
-
<div class="video-wrapper">
|
66 |
-
<video id="phoneVideo">
|
67 |
-
<source src="video.mp4" type="video/mp4">
|
68 |
-
Your browser does not support the video tag.
|
69 |
-
</video>
|
70 |
-
</div>
|
71 |
-
-->
|
72 |
</div>
|
73 |
|
74 |
<div class="controls">
|
@@ -81,7 +73,6 @@
|
|
81 |
<div id="plotDiv"></div>
|
82 |
|
83 |
<script>
|
84 |
-
const csvFilePath = 'https://huggingface.co/datasets/cyberorigin/fold_towels/blob/main/MoCap/mocap.csv';
|
85 |
const body_part_names = [
|
86 |
'Left Shoulder', 'Right Upper Arm', 'Left Lower Leg', 'Spine1', 'Right Upper Leg',
|
87 |
'Spine3', 'Right Lower Arm', 'Left Foot', 'Right Lower Leg', 'Right Shoulder',
|
@@ -90,7 +81,6 @@
|
|
90 |
];
|
91 |
|
92 |
const laptopVideo = document.getElementById('laptopVideo');
|
93 |
-
//const phoneVideo = document.getElementById('phoneVideo');
|
94 |
const playPauseBtn = document.getElementById('playPauseBtn');
|
95 |
const rewindBtn = document.getElementById('rewindBtn');
|
96 |
const forwardBtn = document.getElementById('forwardBtn');
|
@@ -98,17 +88,16 @@
|
|
98 |
|
99 |
let animationFrameId;
|
100 |
let isPlaying = false;
|
|
|
101 |
|
102 |
function togglePlayPause() {
|
103 |
if (!isPlaying) {
|
104 |
laptopVideo.play();
|
105 |
-
//phoneVideo.play();
|
106 |
playPauseBtn.textContent = '鈴革笍';
|
107 |
isPlaying = true;
|
108 |
animate3DVisualization();
|
109 |
} else {
|
110 |
laptopVideo.pause();
|
111 |
-
//phoneVideo.pause();
|
112 |
playPauseBtn.textContent = '鈻讹笍';
|
113 |
isPlaying = false;
|
114 |
cancelAnimationFrame(animationFrameId);
|
@@ -117,19 +106,16 @@
|
|
117 |
|
118 |
function rewind() {
|
119 |
laptopVideo.currentTime -= 5;
|
120 |
-
//phoneVideo.currentTime -= 5;
|
121 |
update3DVisualization();
|
122 |
}
|
123 |
|
124 |
function forward() {
|
125 |
laptopVideo.currentTime += 5;
|
126 |
-
//phoneVideo.currentTime += 5;
|
127 |
update3DVisualization();
|
128 |
}
|
129 |
|
130 |
function restart() {
|
131 |
laptopVideo.currentTime = 0;
|
132 |
-
//phoneVideo.currentTime = 0;
|
133 |
update3DVisualization();
|
134 |
}
|
135 |
|
@@ -142,8 +128,6 @@
|
|
142 |
return body_part_names.map(part => parseFloat(data[`${part}_${coordinate}`]));
|
143 |
}
|
144 |
|
145 |
-
let frames;
|
146 |
-
|
147 |
function processData(results) {
|
148 |
console.log("Processing data:", results);
|
149 |
|
@@ -196,23 +180,22 @@
|
|
196 |
}
|
197 |
}
|
198 |
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
.
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
.catch(error => console.error('Error loading the CSV file:', error));
|
215 |
</script>
|
216 |
</body>
|
217 |
|
218 |
-
</html>
|
|
|
61 |
Your browser does not support the video tag.
|
62 |
</video>
|
63 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
</div>
|
65 |
|
66 |
<div class="controls">
|
|
|
73 |
<div id="plotDiv"></div>
|
74 |
|
75 |
<script>
|
|
|
76 |
const body_part_names = [
|
77 |
'Left Shoulder', 'Right Upper Arm', 'Left Lower Leg', 'Spine1', 'Right Upper Leg',
|
78 |
'Spine3', 'Right Lower Arm', 'Left Foot', 'Right Lower Leg', 'Right Shoulder',
|
|
|
81 |
];
|
82 |
|
83 |
const laptopVideo = document.getElementById('laptopVideo');
|
|
|
84 |
const playPauseBtn = document.getElementById('playPauseBtn');
|
85 |
const rewindBtn = document.getElementById('rewindBtn');
|
86 |
const forwardBtn = document.getElementById('forwardBtn');
|
|
|
88 |
|
89 |
let animationFrameId;
|
90 |
let isPlaying = false;
|
91 |
+
let frames;
|
92 |
|
93 |
function togglePlayPause() {
|
94 |
if (!isPlaying) {
|
95 |
laptopVideo.play();
|
|
|
96 |
playPauseBtn.textContent = '鈴革笍';
|
97 |
isPlaying = true;
|
98 |
animate3DVisualization();
|
99 |
} else {
|
100 |
laptopVideo.pause();
|
|
|
101 |
playPauseBtn.textContent = '鈻讹笍';
|
102 |
isPlaying = false;
|
103 |
cancelAnimationFrame(animationFrameId);
|
|
|
106 |
|
107 |
function rewind() {
|
108 |
laptopVideo.currentTime -= 5;
|
|
|
109 |
update3DVisualization();
|
110 |
}
|
111 |
|
112 |
function forward() {
|
113 |
laptopVideo.currentTime += 5;
|
|
|
114 |
update3DVisualization();
|
115 |
}
|
116 |
|
117 |
function restart() {
|
118 |
laptopVideo.currentTime = 0;
|
|
|
119 |
update3DVisualization();
|
120 |
}
|
121 |
|
|
|
128 |
return body_part_names.map(part => parseFloat(data[`${part}_${coordinate}`]));
|
129 |
}
|
130 |
|
|
|
|
|
131 |
function processData(results) {
|
132 |
console.log("Processing data:", results);
|
133 |
|
|
|
180 |
}
|
181 |
}
|
182 |
|
183 |
+
async function loadDataset() {
|
184 |
+
const response = await fetch('https://huggingface.co/api/datasets/cyberorigin/fold_towels/resolve/main/MoCap/mocap.csv');
|
185 |
+
if (!response.ok) {
|
186 |
+
throw new Error(`HTTP error! status: ${response.status}`);
|
187 |
+
}
|
188 |
+
const csvString = await response.text();
|
189 |
+
console.log("CSV data loaded successfully");
|
190 |
+
Papa.parse(csvString, {
|
191 |
+
header: true,
|
192 |
+
dynamicTyping: true,
|
193 |
+
complete: processData
|
194 |
+
});
|
195 |
+
}
|
196 |
+
|
197 |
+
loadDataset().catch(error => console.error('Error loading the CSV file:', error));
|
|
|
198 |
</script>
|
199 |
</body>
|
200 |
|
201 |
+
</html>
|