Skip to content

Commit 5753b7a

Browse files
committed
update example 2
1 parent 97e811e commit 5753b7a

3 files changed

Lines changed: 81 additions & 16 deletions

File tree

app.js

Lines changed: 79 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,63 @@ const taskConfigs = {
77
hang_mug: {
88
name: 'Hanging Mug',
99
image: 'media/images/hang_mug.png',
10-
instructions: [
11-
'Hang the blue mug on the left branch',
12-
'Hang the red mug on the branch furthest to it',
13-
'Hang the red mug on one branch, sorry, the blue one.',
14-
'I want to use the blue mug. Hang the red mug on one branch.'
15-
],
16-
placeholder: 'Hang the blue mug on the left branch.',
10+
configs: {
11+
config_1: {
12+
instructions: [
13+
'Hang the blue mug on the left branch',
14+
'Hang the red mug on the branch furthest to it',
15+
'Hang the red mug on one branch, sorry, the blue one.',
16+
'I want to use the blue mug. Hang the red mug on one branch.'
17+
],
18+
placeholder: 'Hang the blue mug on the left branch.'
19+
},
20+
config_2: {
21+
instructions: [
22+
'Hang the green mug on the left branch',
23+
'Hang the red mug on the branch furthest to it',
24+
'Hang the red mug on one branch, sorry, the green one.',
25+
'I want to use the green mug. Hang the red mug on one branch.'
26+
],
27+
placeholder: 'Hang the green mug on the center branch.'
28+
},
29+
config_3: {
30+
instructions: [
31+
'Hang the blue mug on the left branch',
32+
'Hang the red mug on the branch furthest to it',
33+
'Hang the red mug on one branch, sorry, the blue one.',
34+
'I want to use the blue mug. Hang the red mug on one branch.'
35+
],
36+
placeholder: 'Hang the blue mug on the left branch.'
37+
}
38+
},
1739
backendEndpoint: '/generate'
1840
},
1941
pack_battery: {
2042
name: 'Packing Battery',
2143
image: 'media/images/pack_battery.png',
22-
instructions: [
23-
'I want to put a battery into the slot on the right column',
24-
'Put the battery to the slot furthest to it'
25-
],
26-
placeholder: 'I want to put a battery into the slot on the right column.',
44+
configs: {
45+
config_1: {
46+
instructions: [
47+
'I want to put a battery into the slot on the right column',
48+
'Put the battery to the slot furthest to it'
49+
],
50+
placeholder: 'I want to put a battery into the slot on the right column.'
51+
},
52+
config_2: {
53+
instructions: [
54+
'I want to put a battery into the slot on the right column',
55+
'Put the battery to the slot furthest to it'
56+
],
57+
placeholder: 'I want to put a battery into the slot on the right column.'
58+
},
59+
config_3: {
60+
instructions: [
61+
'I want to put a battery into the slot on the right column',
62+
'Put the battery to the slot furthest to it'
63+
],
64+
placeholder: 'I want to put a battery into the slot on the right column.'
65+
}
66+
},
2767
backendEndpoint: '/generate_battery'
2868
}
2969
};
@@ -109,7 +149,8 @@ function handleTaskSelect() {
109149

110150
// Update instruction dropdown
111151
instructionSelect.innerHTML = '';
112-
taskData.instructions.forEach(instruction => {
152+
const configs = taskData.configs[currentConfig];
153+
configs.instructions.forEach(instruction => {
113154
const option = document.createElement('option');
114155
option.value = instruction;
115156
option.textContent = instruction;
@@ -123,7 +164,7 @@ function handleTaskSelect() {
123164
instructionSelect.appendChild(customOption);
124165

125166
// Update placeholder
126-
instructionInput.placeholder = taskData.placeholder;
167+
instructionInput.placeholder = configs.placeholder;
127168

128169
// Reset to first configuration
129170
configSelect.value = 'config_1';
@@ -141,11 +182,35 @@ function handleTaskSelect() {
141182
function handleConfigSelect() {
142183
const configSelect = document.getElementById('config-select');
143184
const taskImage = document.getElementById('task-image');
185+
const instructionSelect = document.getElementById('instruction-select');
186+
const instructionInput = document.getElementById('instruction');
187+
144188
currentConfig = configSelect.value;
145189

146190
// Update image to use task and config specific path
147191
taskImage.src = `media/images/${currentTask}/${currentConfig}.png`;
148192

193+
// Update instruction dropdown based on current task and config
194+
const taskData = taskConfigs[currentTask];
195+
const configData = taskData.configs[currentConfig];
196+
197+
instructionSelect.innerHTML = '';
198+
configData.instructions.forEach(instruction => {
199+
const option = document.createElement('option');
200+
option.value = instruction;
201+
option.textContent = instruction;
202+
instructionSelect.appendChild(option);
203+
});
204+
205+
// Add custom option
206+
const customOption = document.createElement('option');
207+
customOption.value = 'custom';
208+
customOption.textContent = 'Custom instruction';
209+
instructionSelect.appendChild(customOption);
210+
211+
// Update placeholder
212+
instructionInput.placeholder = configData.placeholder;
213+
149214
// Load intermediate results for selected configuration
150215
loadDefaultIntermediateResults();
151216
loadDefaultPointCloud();

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ <h1 class="title is-1 publication-title">CodeDiffuser: Attention-Enhanced Diffus
168168

169169
<!-- Video Link -->
170170
<span class="link-block">
171-
<a target="_blank" href="https://youtu.be/IaDySSp5Wf8"
171+
<a target="_blank" href="https://youtu.be/b4ssu_V85ek"
172172
class="external-link button is-normal is-rounded is-dark">
173173
<span class="icon">
174174
<i class="fab fa-youtube"></i>
@@ -394,7 +394,7 @@ <h2 class="title is-3">Abstract</h2>
394394
<div class="column is-full">
395395
<h2 class="title is-3">Video</h2>
396396
<div class="publication-video">
397-
<iframe src="https://www.youtube.com/embed/IaDySSp5Wf8"
397+
<iframe src="https://www.youtube.com/embed/b4ssu_V85ek"
398398
frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
399399
</div>
400400
</div>

media/images/hang_mug/config_2.png

15.5 KB
Loading

0 commit comments

Comments
 (0)