Skip to content

Commit 600f95d

Browse files
authored
Merge pull request #977 from Labelbox/maxime_hf_tutorial
hugging face tutorial - forced images resize to 224x224
2 parents 3e701a4 + 7bf1a12 commit 600f95d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/integrations/huggingface/huggingface.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
"cell_type": "code",
5151
"outputs": [
5252
{
53-
"output_type": "stream",
5453
"name": "stdout",
54+
"output_type": "stream",
5555
"text": [
5656
"\u001b[?25l \u001b[90m\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u001b[0m \u001b[32m0.0/190.5 KB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[90m\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u001b[0m \u001b[32m190.5/190.5 KB\u001b[0m \u001b[31m7.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
5757
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
@@ -269,7 +269,7 @@
269269
" data_row_urls_chunk = data_row_urls[i:i+batch_size]\n",
270270
" data_row_ids_chunk = data_row_ids[i:i+batch_size]\n",
271271
" # download images\n",
272-
" imgs = [PIL.Image.open(requests.get(data_row_url, stream=True).raw).convert('RGB') for data_row_url in data_row_urls_chunk]\n",
272+
" imgs = [PIL.Image.open(requests.get(data_row_url, stream=True).raw).convert('RGB').resize((224, 224)) for data_row_url in data_row_urls_chunk]\n",
273273
" # process images\n",
274274
" img_hf = image_processor(imgs, return_tensors=\"pt\")\n",
275275
" # generate resnet embeddings, thanks to inference\n",
@@ -711,4 +711,4 @@
711711
"execution_count": null
712712
}
713713
]
714-
}
714+
}

0 commit comments

Comments
 (0)