Skip to content

Commit 32622fd

Browse files
committed
simplified installation
1 parent 415353d commit 32622fd

File tree

1 file changed

+30
-14
lines changed

1 file changed

+30
-14
lines changed

nbs/animation.ipynb

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,34 @@
4141
"#@title Connect to the Stability API\n",
4242
"import grpc\n",
4343
"import os\n",
44+
"from pathlib import Path\n",
45+
"import shutil\n",
4446
"import sys\n",
4547
"\n",
46-
"def pull_repo(path: str, repo_url: str, branch: str, commit: str):\n",
47-
" if os.path.exists(path):\n",
48-
" %cd -q $path\n",
49-
" !git pull origin $branch --quiet\n",
50-
" else:\n",
51-
" !git clone -b $branch $repo_url $path\n",
52-
" %cd -q $path\n",
53-
" !git checkout --quiet $commit\n",
54-
" !git submodule update --init --recursive --quiet\n",
55-
" %cd -q ..\n",
5648
"\n",
57-
"# Download the Python Stability SDK animation branch\n",
58-
"pull_repo(\"stability-sdk\", \"https://github.com/Stability-AI/stability-sdk.git\", \"anima\", \"a27313e43b23869867e23e0693111a5807e112f9\")\n",
49+
"# def pull_repo(path: str, repo_url: str, branch: str, commit: str):\n",
50+
"# if Path(path).exists():\n",
51+
"# #%cd -q $path\n",
52+
"# !git pull origin $branch --quiet --git-dir $path\n",
53+
"# else:\n",
54+
"# !git clone -b $branch $repo_url $path\n",
55+
"# #%cd -q $path\n",
56+
"# !git checkout --quiet $commit\n",
57+
"# !git submodule update --init --recursive --quiet\n",
58+
"# %cd -q ..\n",
59+
"\n",
60+
"# # Download the Python Stability SDK animation branch\n",
61+
"# pull_repo(\"stability-sdk\", \"https://github.com/Stability-AI/stability-sdk.git\", \"anima\", \"a27313e43b23869867e23e0693111a5807e112f9\")\n",
62+
"\n",
63+
"path = Path('stability-sdk')\n",
64+
"if path.exists():\n",
65+
" shutil.rmtree(path)\n",
66+
" !pip uninstall stability-sdk\n",
67+
"\n",
68+
"\n",
69+
"!git clone -b anima --recurse-submodules https://github.com/Stability-AI/stability-sdk\n",
70+
"!touch ./stability-sdk/src/stability_sdk/interfaces/__init__.py\n",
71+
"!pip install ./stability-sdk\n",
5972
"\n",
6073
"sys.path.append(\"stability-sdk/src\")\n",
6174
"import stability_sdk.client\n",
@@ -64,8 +77,11 @@
6477
" key_frame_inbetweens,\n",
6578
" key_frame_parse,\n",
6679
")\n",
67-
"import generation_pb2 as generation\n",
68-
"import generation_pb2_grpc as generation_grpc\n",
80+
"#import generation_pb2 as generation\n",
81+
"#import generation_pb2_grpc as generation_grpc\n",
82+
"\n",
83+
"from stability_sdk.client import generation, generation_grpc # not a huge fan of this but at least it works\n",
84+
"\n",
6985
"\n",
7086
"# GRPC endpoint and engines\n",
7187
"GRPC_HOST = \"\" #@param {type:\"string\"}\n",

0 commit comments

Comments
 (0)