Skip to content

Commit

Permalink
do not use wait key in sam2 (openvinotoolkit#2537)
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova authored Nov 19, 2024
1 parent 57939f0 commit a89dc12
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 223 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,31 @@
},
"outputs": [],
"source": [
"%pip install -q --extra-index-url https://download.pytorch.org/whl/cpu \"torch>=2.1\" \"torchvision\"\n",
"%pip install -q \"diffusers>=0.14.0\" \"matplotlib>=3.4\" \"transformers>=4.30.2\" \"controlnet-aux>=0.0.6\" \"gradio>=3.36\" --extra-index-url https://download.pytorch.org/whl/cpu\n",
"%pip install -q \"openvino>=2023.1.0\" \"datasets>=2.14.6\" \"nncf>=2.7.0\"\n",
"\n",
"import requests\n",
"from pathlib import Path\n",
"\n",
"utility_files = [\"notebook_utils.py\", \"pip_helper.py\"]\n",
"\n",
"for utility in utility_files:\n",
" if not Path(utility).exists():\n",
" r = requests.get(f\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/{utility}\")\n",
" with open(utility, \"w\") as f:\n",
" f.write(r.text)\n",
"\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
"\n",
"from pip_helper import pip_install\n",
"\n",
"pip_install(\"torch>=2.1\", \"torchvision\", \"--extra-index-url\", \"https://download.pytorch.org/whl/cpu\")\n",
"pip_install(\n",
" \"diffusers>=0.14.0\",\n",
" \"matplotlib>=3.4\",\n",
" \"transformers>=4.30.2\",\n",
" \"controlnet-aux>=0.0.6\",\n",
" \"gradio>=3.36\",\n",
" \"--extra-index-url\",\n",
" \"https://download.pytorch.org/whl/cpu\",\n",
")\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)"
"pip_install(\"openvino>=2023.1.0\", \"datasets>=2.14.6\", \"nncf>=2.7.0\", \"opencv-python\")"
]
},
{
Expand Down Expand Up @@ -221,14 +236,18 @@
}
],
"source": [
"import requests\n",
"from PIL import Image\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from notebook_utils import download_file\n",
"\n",
"example_url = \"https://user-images.githubusercontent.com/29454499/224540208-c172c92a-9714-4a7b-857a-b1e54b4d4791.jpg\"\n",
"img = Image.open(requests.get(example_url, stream=True).raw)\n",
"\n",
"image_path = Path(\"example_image.jpg\")\n",
"if not image_path.exists():\n",
" download_file(image_path, filename=\"example_image.jpg\")\n",
"\n",
"img = Image.open(image_path)\n",
"pose = pose_estimator(img)\n",
"\n",
"\n",
Expand Down Expand Up @@ -1533,10 +1552,12 @@
"# Fetch `skip_kernel_extension` module\n",
"import requests\n",
"\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/skip_kernel_extension.py\",\n",
")\n",
"open(\"skip_kernel_extension.py\", \"w\").write(r.text)\n",
"\n",
"if not Path(\"skip_kernel_extension.py\").exists():\n",
" r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/skip_kernel_extension.py\",\n",
" )\n",
" open(\"skip_kernel_extension.py\", \"w\").write(r.text)\n",
"\n",
"int8_pipe = None\n",
"\n",
Expand Down
Loading

0 comments on commit a89dc12

Please sign in to comment.