|
41 | 41 | "#@title Connect to the Stability API\n", |
42 | 42 | "import grpc\n", |
43 | 43 | "import os\n", |
| 44 | + "from pathlib import Path\n", |
| 45 | + "import shutil\n", |
44 | 46 | "import sys\n", |
45 | 47 | "\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", |
56 | 48 | "\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", |
59 | 72 | "\n", |
60 | 73 | "sys.path.append(\"stability-sdk/src\")\n", |
61 | 74 | "import stability_sdk.client\n", |
|
64 | 77 | " key_frame_inbetweens,\n", |
65 | 78 | " key_frame_parse,\n", |
66 | 79 | ")\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", |
69 | 85 | "\n", |
70 | 86 | "# GRPC endpoint and engines\n", |
71 | 87 | "GRPC_HOST = \"\" #@param {type:\"string\"}\n", |
|
0 commit comments