Skip to content

Commit e678798

Browse files
committed
offline experience fixes
1 parent 9f4fefd commit e678798

File tree

6 files changed

+20
-17
lines changed

6 files changed

+20
-17
lines changed

notebooks/blip-visual-language-processing/blip-visual-language-processing.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,6 +1644,7 @@
16441644
"\n",
16451645
"comp_text_encoder = core.compile_model(TEXT_ENCODER_OV, device.value)\n",
16461646
"comp_text_decoder_with_past = core.compile_model(TEXT_DECODER_OV, device.value)\n",
1647+
"comp_vision_model = core.compile_model(VISION_MODEL_OV, device.value)\n",
16471648
"fp_text_decoder.forward = partial(text_decoder_forward, ov_text_decoder_with_past=comp_text_decoder_with_past)\n",
16481649
"fp16_model = OVBlipModel(model.config, model.decoder_start_token_id, comp_vision_model, comp_text_encoder, fp_text_decoder)"
16491650
]

notebooks/depth-anything/depth-anything.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,7 @@
6969
" r = requests.get(\n",
7070
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/cmd_helper.py\",\n",
7171
" )\n",
72-
" open(\"cmd_helper.py\", \"w\").write(r.text)\n",
73-
"\n",
74-
"if not Path(\"notebook_utils.py\").exists():\n",
75-
" r = requests.get(\n",
76-
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
77-
" )\n",
78-
" open(\"notebook_utils.py\", \"w\").write(r.text)"
72+
" open(\"cmd_helper.py\", \"w\").write(r.text)"
7973
]
8074
},
8175
{
@@ -109,7 +103,13 @@
109103
"if platform.system() == \"Darwin\":\n",
110104
" %pip install -q \"numpy<2.0.0\"\n",
111105
"if platform.python_version_tuple()[1] in [\"8\", \"9\"]:\n",
112-
" %pip install -q \"gradio-imageslider<=0.0.17\" \"typing-extensions>=4.9.0\""
106+
" %pip install -q \"gradio-imageslider<=0.0.17\" \"typing-extensions>=4.9.0\"\n",
107+
"\n",
108+
"if not Path(\"notebook_utils.py\").exists():\n",
109+
" r = requests.get(\n",
110+
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
111+
" )\n",
112+
" open(\"notebook_utils.py\", \"w\").write(r.text)"
113113
]
114114
},
115115
{

notebooks/instruct-pix2pix-image-editing/instruct-pix2pix-image-editing.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,12 +1080,13 @@
10801080
"source": [
10811081
"import io\n",
10821082
"import requests\n",
1083+
"from diffusers.utils import load_image\n",
10831084
"\n",
10841085
"default_image_path = Path(\"default_image.png\")\n",
10851086
"default_url = \"https://user-images.githubusercontent.com/29454499/223343459-4ac944f0-502e-4acf-9813-8e9f0abc8a16.jpg\"\n",
10861087
"\n",
10871088
"if not default_image_path.exists():\n",
1088-
" img = PIL.Image.open(io.BytesIO(requests.get(default_url, stream=True).raw))\n",
1089+
" img = load_image(default_url)\n",
10891090
" img.save(default_image_path)\n",
10901091
"\n",
10911092
"default_image = PIL.Image.open(default_image_path)\n",

notebooks/optical-character-recognition/optical-character-recognition.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
" )\n",
9595
"\n",
9696
" open(\"notebook_utils.py\", \"w\").write(r.text)\n",
97-
"from notebook_utils import load_image, device_widget\n",
97+
"from notebook_utils import download_file, device_widget\n",
9898
"\n",
9999
"# Read more about telemetry collection at https://github.com/openvinotoolkit/openvino_notebooks?tab=readme-ov-file#-telemetry\n",
100100
"from notebook_utils import collect_telemetry\n",
@@ -290,14 +290,14 @@
290290
}
291291
],
292292
"source": [
293-
"# The `image_file` variable can point to a URL or a local image.\n",
294-
"image_url = \"https://storage.openvinotoolkit.org/repositories/openvino_notebooks/data/data/image/intel_rnb.jpg\"\n",
295-
"\n",
296293
"image_path = Path(\"intel_rnb.jpg\")\n",
297294
"\n",
298295
"if not image_path.exists():\n",
299-
" image = load_image(image_url)\n",
300-
" cv2.imwrite(str(image_path), image)\n",
296+
" download_file(\n",
297+
" url=\"https://storage.openvinotoolkit.org/repositories/openvino_notebooks/data/data/image/intel_rnb.jpg\",\n",
298+
" filename=image_path.name,\n",
299+
" directory=image_path.parent,\n",
300+
" )\n",
301301
"else:\n",
302302
" image = cv2.imread(str(image_path))\n",
303303
"\n",

notebooks/yolov11-optimization/yolov11-keypoint-detection.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,13 @@
117117
"# Fetch `notebook_utils` module\n",
118118
"import requests\n",
119119
"\n",
120-
"if Path(\"notebook_utils.py\").exists():\n",
120+
"if not Path(\"notebook_utils.py\").exists():\n",
121121
" r = requests.get(\n",
122122
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
123123
" )\n",
124124
"\n",
125125
" open(\"notebook_utils.py\", \"w\").write(r.text)\n",
126+
"\n",
126127
"from notebook_utils import download_file, VideoPlayer, device_widget\n",
127128
"\n",
128129
"# Read more about telemetry collection at https://github.com/openvinotoolkit/openvino_notebooks?tab=readme-ov-file#-telemetry\n",

notebooks/yolov8-optimization/yolov8-object-detection.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"# Fetch `notebook_utils` module\n",
133133
"import requests\n",
134134
"\n",
135-
"if not Path(\"notebook_utils.py\").exists()\n",
135+
"if not Path(\"notebook_utils.py\").exists():\n",
136136
" r = requests.get(\n",
137137
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
138138
" )\n",

0 commit comments

Comments
 (0)