Skip to content

Commit 3579c08

Browse files
authored
fix standalone execution text2image genai (#2665)
1 parent 7bc7519 commit 3579c08

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

notebooks/text-to-image-genai/text-to-image-genai.ipynb

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"source": [
5757
"import platform\n",
5858
"import requests\n",
59+
"from pathlib import Path\n",
5960
"\n",
6061
"\n",
6162
"%pip install -q \"git+https://github.com/huggingface/optimum-intel.git\"\n",
@@ -65,15 +66,19 @@
6566
"if platform.system() == \"Darwin\":\n",
6667
" %pip install -q \"numpy<2.0.0\"\n",
6768
"\n",
68-
"r = requests.get(\n",
69-
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
70-
")\n",
71-
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
7269
"\n",
73-
"r = requests.get(\n",
74-
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/cmd_helper.py\",\n",
75-
")\n",
76-
"open(\"cmd_helper.py\", \"w\").write(r.text)"
70+
"if not Path(\"notebook_utils.py\").exists():\n",
71+
" r = requests.get(\n",
72+
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
73+
" )\n",
74+
" open(\"notebook_utils.py\", \"w\").write(r.text)\n",
75+
"\n",
76+
"\n",
77+
"if not Path(\"cmd_helper.py\").exists():\n",
78+
" r = requests.get(\n",
79+
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/cmd_helper.py\",\n",
80+
" )\n",
81+
" open(\"cmd_helper.py\", \"w\").write(r.text)"
7782
]
7883
},
7984
{
@@ -357,6 +362,19 @@
357362
"[back to top ⬆️](#Table-of-contents:)"
358363
]
359364
},
365+
{
366+
"cell_type": "code",
367+
"execution_count": null,
368+
"id": "175ad576",
369+
"metadata": {},
370+
"outputs": [],
371+
"source": [
372+
"if not Path(\"gradio_helper.py\").exists():\n",
373+
" r = requests.get(\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/notebooks/text-to-image-genai/gradio_helper.py\")\n",
374+
" with open(\"gradio_helper.py\", \"w\") as f:\n",
375+
" f.write(r.text)"
376+
]
377+
},
360378
{
361379
"cell_type": "code",
362380
"execution_count": null,
@@ -402,7 +420,8 @@
402420
"tags": {
403421
"categories": [
404422
"Model Demos",
405-
"AI Trends"
423+
"AI Trends",
424+
"API Overview"
406425
],
407426
"libraries": [],
408427
"other": [

0 commit comments

Comments
 (0)