Update image-classification.html
Browse files- image-classification.html +10 -2
image-classification.html
CHANGED
|
@@ -106,7 +106,11 @@
|
|
| 106 |
// Initialize the sentiment analysis model
|
| 107 |
async function initializeModel() {
|
| 108 |
classifier = await pipeline('image-classification', 'Xenova/vit-base-patch16-224');
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
}
|
| 111 |
|
| 112 |
async function classifyImage() {
|
|
@@ -130,7 +134,11 @@
|
|
| 130 |
const url = URL.createObjectURL(file);
|
| 131 |
|
| 132 |
const result = await classifier(url);
|
| 133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
document.getElementById("outputAreaLocal").innerText = JSON.stringify(result, null, 2);
|
| 136 |
}
|
|
|
|
| 106 |
// Initialize the sentiment analysis model
|
| 107 |
async function initializeModel() {
|
| 108 |
classifier = await pipeline('image-classification', 'Xenova/vit-base-patch16-224');
|
| 109 |
+
if (Promise.resolve(classifier) === classifier) {
|
| 110 |
+
console.log("classifier is a Promise object");
|
| 111 |
+
} else {
|
| 112 |
+
console.log("classifier is not a Promise object");
|
| 113 |
+
}
|
| 114 |
}
|
| 115 |
|
| 116 |
async function classifyImage() {
|
|
|
|
| 134 |
const url = URL.createObjectURL(file);
|
| 135 |
|
| 136 |
const result = await classifier(url);
|
| 137 |
+
if (Promise.resolve(classifier) === classifier) {
|
| 138 |
+
console.log("classifier is a Promise object");
|
| 139 |
+
} else {
|
| 140 |
+
console.log("classifier is not a Promise object");
|
| 141 |
+
}
|
| 142 |
|
| 143 |
document.getElementById("outputAreaLocal").innerText = JSON.stringify(result, null, 2);
|
| 144 |
}
|