Update index.js
Browse files
index.js
CHANGED
@@ -134,6 +134,7 @@ async function handleQuery(imageUrl, query) {
|
|
134 |
status.textContent = 'Analyzing...';
|
135 |
|
136 |
const result = await imageTextToText(imageUrl, query, (out) => {
|
|
|
137 |
output.textContent = out;
|
138 |
});
|
139 |
} catch (err) {
|
@@ -274,7 +275,7 @@ export async function imageTextToText(
|
|
274 |
}
|
275 |
|
276 |
let output = '';
|
277 |
-
|
278 |
while (
|
279 |
num_decode < MAX_SINGLE_CHAT_LENGTH &&
|
280 |
Number(history_len.data[0]) < MAX_SEQ_LENGTH
|
@@ -353,8 +354,7 @@ export async function imageTextToText(
|
|
353 |
} else {
|
354 |
const decoded = tokenizer.decode([...token_id.data]);
|
355 |
cb(output);
|
356 |
-
|
357 |
-
output += decoded;
|
358 |
}
|
359 |
}
|
360 |
return output;
|
|
|
134 |
status.textContent = 'Analyzing...';
|
135 |
|
136 |
const result = await imageTextToText(imageUrl, query, (out) => {
|
137 |
+
console.log({out});
|
138 |
output.textContent = out;
|
139 |
});
|
140 |
} catch (err) {
|
|
|
275 |
}
|
276 |
|
277 |
let output = '';
|
278 |
+
|
279 |
while (
|
280 |
num_decode < MAX_SINGLE_CHAT_LENGTH &&
|
281 |
Number(history_len.data[0]) < MAX_SEQ_LENGTH
|
|
|
354 |
} else {
|
355 |
const decoded = tokenizer.decode([...token_id.data]);
|
356 |
cb(output);
|
357 |
+
output += decoded.toString();
|
|
|
358 |
}
|
359 |
}
|
360 |
return output;
|