function setupGui() {
  // Create training buttons and info texts
  for (let i = 0; i < NUM_CLASSES; i++) {
    const div = document.createElement('div');
    document.body.appendChild(div);
    div.style.marginBottom = '10px';

    // Create training button
    const button = document.createElement('button');
    button.innerText = 'Train ' + i;
    div.appendChild(button);

    // Listen for mouse events when clicking the button
    button.addEventListener('click', () => {
      training = i;
      requestAnimationFrame(() => training = -1);
    });

    // Create info text
    const infoText = document.createElement('span');
    infoText.innerText = ' No examples added';
    div.appendChild(infoText);
    infoTexts.push(infoText);
  }
}
function setupGui() {
  // Create training buttons and info texts
  for (let i = 0; i < NUM_CLASSES; i++) {
    const div = document.createElement('div');
    document.body.appendChild(div);
    div.style.marginBottom = '10px';

    // Create training button
    const button = document.createElement('button');
    button.innerText = 'Train ' + i;
    div.appendChild(button);

    // Listen for mouse events when clicking the button
    button.addEventListener('click', () => {
      training = i;
      requestAnimationFrame(() => training = -1);
    });

    // Create info text
    const infoText = document.createElement('span');
    infoText.innerText = ' No examples added';
    div.appendChild(infoText);
    infoTexts.push(infoText);
  }
}
function setupGui ( ) { // Create training buttons and info texts for ( let i = 0 ; i < NUM_CLASSES ; i ++ ) { const div = document . createElement ( 'div' ) ; document . body . appendChild ( div ) ; div . style . marginBottom = '10px' ; // Create training button const button = document . createElement ( 'button' ) ; button . innerText = 'Train ' + i ; div . appendChild ( button ) ; // Listen for mouse events when clicking the button button . addEventListener ( 'click' , ( ) => { training = i ; requestAnimationFrame ( ( ) => training = - 1 ) ; } ) ; // Create info text const infoText = document . createElement ( 'span' ) ; infoText . innerText = ' No examples added' ; div . appendChild ( infoText ) ; infoTexts . push ( infoText ) ; } }
Setup training GUI. Adds a training button for each class,
and sets up mouse events.
Setup training GUI . Adds a training button for each class and sets up mouse events .
Creates the GUI for the training buttons