Skip to content

Commit

Permalink
simplified installation
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarx committed Oct 31, 2022
1 parent 415353d commit 32622fd
Showing 1 changed file with 30 additions and 14 deletions.
44 changes: 30 additions & 14 deletions nbs/animation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,34 @@
"#@title Connect to the Stability API\n",
"import grpc\n",
"import os\n",
"from pathlib import Path\n",
"import shutil\n",
"import sys\n",
"\n",
"def pull_repo(path: str, repo_url: str, branch: str, commit: str):\n",
" if os.path.exists(path):\n",
" %cd -q $path\n",
" !git pull origin $branch --quiet\n",
" else:\n",
" !git clone -b $branch $repo_url $path\n",
" %cd -q $path\n",
" !git checkout --quiet $commit\n",
" !git submodule update --init --recursive --quiet\n",
" %cd -q ..\n",
"\n",
"# Download the Python Stability SDK animation branch\n",
"pull_repo(\"stability-sdk\", \"https://github.com/Stability-AI/stability-sdk.git\", \"anima\", \"a27313e43b23869867e23e0693111a5807e112f9\")\n",
"# def pull_repo(path: str, repo_url: str, branch: str, commit: str):\n",
"# if Path(path).exists():\n",
"# #%cd -q $path\n",
"# !git pull origin $branch --quiet --git-dir $path\n",
"# else:\n",
"# !git clone -b $branch $repo_url $path\n",
"# #%cd -q $path\n",
"# !git checkout --quiet $commit\n",
"# !git submodule update --init --recursive --quiet\n",
"# %cd -q ..\n",
"\n",
"# # Download the Python Stability SDK animation branch\n",
"# pull_repo(\"stability-sdk\", \"https://github.com/Stability-AI/stability-sdk.git\", \"anima\", \"a27313e43b23869867e23e0693111a5807e112f9\")\n",
"\n",
"path = Path('stability-sdk')\n",
"if path.exists():\n",
" shutil.rmtree(path)\n",
" !pip uninstall stability-sdk\n",
"\n",
"\n",
"!git clone -b anima --recurse-submodules https://github.com/Stability-AI/stability-sdk\n",
"!touch ./stability-sdk/src/stability_sdk/interfaces/__init__.py\n",
"!pip install ./stability-sdk\n",
"\n",
"sys.path.append(\"stability-sdk/src\")\n",
"import stability_sdk.client\n",
Expand All @@ -64,8 +77,11 @@
" key_frame_inbetweens,\n",
" key_frame_parse,\n",
")\n",
"import generation_pb2 as generation\n",
"import generation_pb2_grpc as generation_grpc\n",
"#import generation_pb2 as generation\n",
"#import generation_pb2_grpc as generation_grpc\n",
"\n",
"from stability_sdk.client import generation, generation_grpc # not a huge fan of this but at least it works\n",
"\n",
"\n",
"# GRPC endpoint and engines\n",
"GRPC_HOST = \"\" #@param {type:\"string\"}\n",
Expand Down

1 comment on commit 32622fd

@pharmapsychotic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to keep the checkout of specific commit hash that way the shared test notebook always grabs the version of stability-sdk it is compatible with.

Please sign in to comment.