Update index.js
Browse files
index.js
CHANGED
@@ -13,7 +13,7 @@ const imageContainer = document.getElementById('container');
|
|
13 |
const example = document.getElementById('example');
|
14 |
|
15 |
const EXAMPLE_URL = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg",
|
16 |
-
const INPUT_IMAGE_SIZE = [960, 960]
|
17 |
const HEIGHT_FACTOR = 10;
|
18 |
const WIDTH_FACTOR = 10;
|
19 |
const IMAGE_EMBED_SIZE = WIDTH_FACTOR * HEIGHT_FACTOR;
|
@@ -61,14 +61,14 @@ async function detect(img) {
|
|
61 |
}
|
62 |
|
63 |
|
64 |
-
export async function
|
65 |
-
imagePath
|
66 |
-
query
|
67 |
vision = true
|
68 |
) {
|
69 |
const suffix = QUANTIZATION ? `_${QUANTIZATION}` : "";
|
70 |
|
71 |
-
const config = (await getModelJSON(BASE_MODEL, "config.json"))
|
72 |
|
73 |
const prompt_head_len = new Tensor("int64", new BigInt64Array([5n]), [1]);
|
74 |
|
|
|
13 |
const example = document.getElementById('example');
|
14 |
|
15 |
const EXAMPLE_URL = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg",
|
16 |
+
const INPUT_IMAGE_SIZE = [960, 960];
|
17 |
const HEIGHT_FACTOR = 10;
|
18 |
const WIDTH_FACTOR = 10;
|
19 |
const IMAGE_EMBED_SIZE = WIDTH_FACTOR * HEIGHT_FACTOR;
|
|
|
61 |
}
|
62 |
|
63 |
|
64 |
+
export async function imageTextToText(
|
65 |
+
imagePath,
|
66 |
+
query,
|
67 |
vision = true
|
68 |
) {
|
69 |
const suffix = QUANTIZATION ? `_${QUANTIZATION}` : "";
|
70 |
|
71 |
+
const config = (await getModelJSON(BASE_MODEL, "config.json"))
|
72 |
|
73 |
const prompt_head_len = new Tensor("int64", new BigInt64Array([5n]), [1]);
|
74 |
|