Skip to content

Commit

Permalink
fix: minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tamis-laan committed Feb 25, 2024
1 parent e33a92f commit 42fdaed
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mnist/mnist.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ async function attach(canvas, classify, clear, results, model_file) {
// Event listener for clearing canvas
classify.addEventListener('click', async function() {

// Disable the button while classifying
classify.disabled = true

// Show loading on results
results.innerText = 'processing ...'

// Create a dummy canvas just for scaling
const scaledCanvas = document.createElement('canvas');

Expand Down Expand Up @@ -138,9 +144,6 @@ async function attach(canvas, classify, clear, results, model_file) {
// Create input tensor
tensor = new ort.Tensor('float32', new Float32Array(inputarray), [1, 1, 28, 28]);

// Disable the button while generating text
classify.disabled = true

// Run the model
const inputs = { input: tensor };
// Get the results
Expand Down

0 comments on commit 42fdaed

Please sign in to comment.