File size: 34,207 Bytes
68cefc5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
{
    "nbformat": 4,
    "nbformat_minor": 0,
    "metadata": {
        "colab": {
            "provenance": [
                {
                    "file_id": "https://gist.github.com/AdamOswald/70f8e6429e99ff44799a7c51b4517496#file-copy-of-fine-tuned-diffusion-gradio-ipynb",
                    "timestamp": 1675347363746,
                }
            ]
        },
        "kernelspec": {"name": "python3", "display_name": "Python 3"},
        "language_info": {"name": "python"},
        "gpuClass": "standard",
        "accelerator": "GPU",
    },
    "cells": [
        {
            "cell_type": "markdown",
            "source": [
                "**Finetuned Diffusion demo 🪄🖼️** \n",
                "\n",
                "With this app you can run multiple fine-tuned Stable Diffusion models, trained on different styles: [Arcane](https://huggingface.co/nitrosocke/Arcane-Diffusion), [Archer](https://huggingface.co/nitrosocke/archer-diffusion), [Elden Ring](https://huggingface.co/nitrosocke/elden-ring-diffusion), [Spider-Verse](https://huggingface.co/nitrosocke/spider-verse-diffusion), [Modern Disney](https://huggingface.co/nitrosocke/modern-disney-diffusion), [Classic Disney](https://huggingface.co/nitrosocke/classic-anim-diffusion), [Waifu](https://huggingface.co/hakurei/waifu-diffusion), [Pokémon](https://huggingface.co/lambdalabs/sd-pokemon-diffusers), [Pony Diffusion](https://huggingface.co/AstraliteHeart/pony-diffusion), [Robo Diffusion](https://huggingface.co/nousr/robo-diffusion), [Cyberpunk Anime](https://huggingface.co/DGSpitzer/Cyberpunk-Anime-Diffusion), [Tron Legacy](https://huggingface.co/dallinmackay/Tron-Legacy-diffusion) + any other custom Diffusers 🧨 SD model hosted on HuggingFace 🤗.",
            ],
            "metadata": {"id": "oBB6SkL2REFn"},
        },
        {
            "cell_type": "markdown",
            "source": ["### 1. Install dependencies"],
            "metadata": {"id": "2o-2jPqITvtD"},
        },
        {
            "cell_type": "code",
            "execution_count": null,
            "metadata": {
                "id": "8WYSV-73rslm",
                "executionInfo": {
                    "status": "ok",
                    "timestamp": 1675347315623,
                    "user_tz": 300,
                    "elapsed": 320217,
                    "user": {"displayName": "", "userId": ""},
                },
                "outputId": "0d67fb80-8d83-4819-a2ff-bc7458c794ac",
                "colab": {"base_uri": "https://localhost:8080/"},
            },
            "outputs": [
                {
                    "output_type": "stream",
                    "name": "stdout",
                    "text": [
                        "Cloning into 'finetuned_diffusionl'...\n",
                        "remote: Enumerating objects: 24, done.\u001b[K\n",
                        "remote: Counting objects: 100% (15/15), done.\u001b[K\n",
                        "remote: Compressing objects: 100% (15/15), done.\u001b[K\n",
                        "remote: Total 24 (delta 7), reused 0 (delta 0), pack-reused 9\u001b[K\n",
                        "Unpacking objects: 100% (24/24), 95.73 KiB | 2.90 MiB/s, done.\n",
                        "/content/finetuned_diffusionl\n",
                        "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/, https://download.pytorch.org/whl/cu113\n",
                        "Collecting git+https://github.com/huggingface/diffusers.git (from -r requirements.txt (line 5))\n",
                        "  Cloning https://github.com/huggingface/diffusers.git to /tmp/pip-req-build-b28tkofz\n",
                        "  Running command git clone --filter=blob:none --quiet https://github.com/huggingface/diffusers.git /tmp/pip-req-build-b28tkofz\n",
                        "  Resolved https://github.com/huggingface/diffusers.git to commit 68ef0666e22a66a5ae6cb57104a8213e85b4be38\n",
                        "  Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n",
                        "  Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n",
                        "  Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
                        "Collecting git+https://github.com/huggingface/transformers (from -r requirements.txt (line 7))\n",
                        "  Cloning https://github.com/huggingface/transformers to /tmp/pip-req-build-gpkpb3qw\n",
                        "  Running command git clone --filter=blob:none --quiet https://github.com/huggingface/transformers /tmp/pip-req-build-gpkpb3qw\n",
                        "  Resolved https://github.com/huggingface/transformers to commit db572b38541269f3653f0cbeca58520ed18ff80c\n",
                        "  Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n",
                        "  Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n",
                        "  Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
                        "Collecting xformers==0.0.15.dev0+4c06c79.d20221205\n",
                        "  Downloading https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.15/xformers-0.0.15.dev0+4c06c79.d20221205-cp38-cp38-linux_x86_64.whl (110.0 MB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m110.0/110.0 MB\u001b[0m \u001b[31m7.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: torch in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 2)) (1.13.1+cu116)\n",
                        "Collecting torchvision==0.13.1+cu113\n",
                        "  Downloading https://download.pytorch.org/whl/cu113/torchvision-0.13.1%2Bcu113-cp38-cp38-linux_x86_64.whl (23.4 MB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m23.4/23.4 MB\u001b[0m \u001b[31m35.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: scipy in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 8)) (1.7.3)\n",
                        "Collecting ftfy\n",
                        "  Downloading ftfy-6.1.1-py3-none-any.whl (53 kB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m53.1/53.1 KB\u001b[0m \u001b[31m6.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: psutil in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 10)) (5.4.8)\n",
                        "Collecting accelerate==0.12.0\n",
                        "  Downloading accelerate-0.12.0-py3-none-any.whl (143 kB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m144.0/144.0 KB\u001b[0m \u001b[31m17.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hCollecting triton==2.0.0.dev20220701\n",
                        "  Downloading triton-2.0.0.dev20220701-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m18.3/18.3 MB\u001b[0m \u001b[31m61.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: numpy in /usr/local/lib/python3.8/dist-packages (from torchvision==0.13.1+cu113->-r requirements.txt (line 3)) (1.21.6)\n",
                        "Collecting torch\n",
                        "  Downloading https://download.pytorch.org/whl/cu113/torch-1.12.1%2Bcu113-cp38-cp38-linux_x86_64.whl (1837.7 MB)\n",
                        "\u001b[2K     \u001b[91m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[91m╸\u001b[0m \u001b[32m1.8/1.8 GB\u001b[0m \u001b[31m23.4 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0mtcmalloc: large alloc 1837744128 bytes == 0x12724000 @  0x7fd971216680 0x7fd971237824 0x5b3128 0x5bbc90 0x5f714c 0x64d800 0x527022 0x504866 0x56bbe1 0x569d8a 0x5f60c3 0x56bbe1 0x569d8a 0x5f60c3 0x56bbe1 0x569d8a 0x5f60c3 0x56bbe1 0x569d8a 0x5f60c3 0x56bbe1 0x569d8a 0x5f60c3 0x56bbe1 0x5f5ee6 0x56bbe1 0x569d8a 0x5f60c3 0x56cc92 0x569d8a 0x5f60c3\n",
                        "tcmalloc: large alloc 2297184256 bytes == 0x7ffc0000 @  0x7fd971216680 0x7fd971236da2 0x5f714c 0x64d800 0x527022 0x504866 0x56bbe1 0x569d8a 0x5f60c3 0x56bbe1 0x569d8a 0x5f60c3 0x56bbe1 0x569d8a 0x5f60c3 0x56bbe1 0x569d8a 0x5f60c3 0x56bbe1 0x569d8a 0x5f60c3 0x56bbe1 0x5f5ee6 0x56bbe1 0x569d8a 0x5f60c3 0x56cc92 0x569d8a 0x5f60c3 0x56bbe1 0x569d8a\n",
                        "\u001b[2K     \u001b[91m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[91m╸\u001b[0m \u001b[32m1.8/1.8 GB\u001b[0m \u001b[31m24.0 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0mtcmalloc: large alloc 1837744128 bytes == 0x12724000 @  0x7fd971216680 0x7fd971237824 0x5f97c1 0x5f8ecc 0x504866 0x56bbe1 0x569d8a 0x5f60c3 0x56bbe1 0x569d8a 0x5f60c3 0x50b32c 0x5f6b7b 0x66731d 0x5f6706 0x571143 0x50b22e 0x570b82 0x569d8a 0x50b3a0 0x570b82 0x569d8a 0x50b3a0 0x56cc92 0x501044 0x56be83 0x501044 0x56be83 0x501044 0x56be83 0x5f5ee6\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.8/1.8 GB\u001b[0m \u001b[31m922.7 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: requests in /usr/local/lib/python3.8/dist-packages (from torchvision==0.13.1+cu113->-r requirements.txt (line 3)) (2.25.1)\n",
                        "Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /usr/local/lib/python3.8/dist-packages (from torchvision==0.13.1+cu113->-r requirements.txt (line 3)) (7.1.2)\n",
                        "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.8/dist-packages (from torchvision==0.13.1+cu113->-r requirements.txt (line 3)) (4.4.0)\n",
                        "Requirement already satisfied: pyyaml in /usr/local/lib/python3.8/dist-packages (from accelerate==0.12.0->-r requirements.txt (line 11)) (6.0)\n",
                        "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.8/dist-packages (from accelerate==0.12.0->-r requirements.txt (line 11)) (21.3)\n",
                        "Requirement already satisfied: cmake in /usr/local/lib/python3.8/dist-packages (from triton==2.0.0.dev20220701->-r requirements.txt (line 14)) (3.22.6)\n",
                        "Requirement already satisfied: filelock in /usr/local/lib/python3.8/dist-packages (from triton==2.0.0.dev20220701->-r requirements.txt (line 14)) (3.9.0)\n",
                        "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.8/dist-packages (from diffusers==0.13.0.dev0->-r requirements.txt (line 5)) (2022.6.2)\n",
                        "Collecting huggingface-hub>=0.10.0\n",
                        "  Downloading huggingface_hub-0.12.0-py3-none-any.whl (190 kB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m190.3/190.3 KB\u001b[0m \u001b[31m24.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: importlib-metadata in /usr/local/lib/python3.8/dist-packages (from diffusers==0.13.0.dev0->-r requirements.txt (line 5)) (6.0.0)\n",
                        "Collecting tokenizers!=0.11.3,<0.14,>=0.11.1\n",
                        "  Downloading tokenizers-0.13.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.6 MB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m7.6/7.6 MB\u001b[0m \u001b[31m103.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.8/dist-packages (from transformers==4.27.0.dev0->-r requirements.txt (line 7)) (4.64.1)\n",
                        "Requirement already satisfied: wcwidth>=0.2.5 in /usr/local/lib/python3.8/dist-packages (from ftfy->-r requirements.txt (line 9)) (0.2.5)\n",
                        "Collecting pyre-extensions==0.0.23\n",
                        "  Downloading pyre_extensions-0.0.23-py3-none-any.whl (11 kB)\n",
                        "Collecting typing-inspect\n",
                        "  Downloading typing_inspect-0.8.0-py3-none-any.whl (8.7 kB)\n",
                        "Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /usr/local/lib/python3.8/dist-packages (from packaging>=20.0->accelerate==0.12.0->-r requirements.txt (line 11)) (3.0.9)\n",
                        "Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.8/dist-packages (from importlib-metadata->diffusers==0.13.0.dev0->-r requirements.txt (line 5)) (3.11.0)\n",
                        "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.8/dist-packages (from requests->torchvision==0.13.1+cu113->-r requirements.txt (line 3)) (2022.12.7)\n",
                        "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.8/dist-packages (from requests->torchvision==0.13.1+cu113->-r requirements.txt (line 3)) (1.24.3)\n",
                        "Requirement already satisfied: chardet<5,>=3.0.2 in /usr/local/lib/python3.8/dist-packages (from requests->torchvision==0.13.1+cu113->-r requirements.txt (line 3)) (4.0.0)\n",
                        "Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.8/dist-packages (from requests->torchvision==0.13.1+cu113->-r requirements.txt (line 3)) (2.10)\n",
                        "Collecting mypy-extensions>=0.3.0\n",
                        "  Downloading mypy_extensions-0.4.3-py2.py3-none-any.whl (4.5 kB)\n",
                        "Building wheels for collected packages: diffusers, transformers\n",
                        "  Building wheel for diffusers (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
                        "  Created wheel for diffusers: filename=diffusers-0.13.0.dev0-py3-none-any.whl size=614289 sha256=a622a26d79327468771949e03b787ef7ef9c3619b91c292c4fff886f45b7c63d\n",
                        "  Stored in directory: /tmp/pip-ephem-wheel-cache-cyi1hs0q/wheels/28/16/cf/d8d37579fd1e7edb978252d850ec9328b055a7582ddfae3b87\n",
                        "  Building wheel for transformers (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
                        "  Created wheel for transformers: filename=transformers-4.27.0.dev0-py3-none-any.whl size=6387778 sha256=40a9d4c3b3fcf39efc6698036e8fe80b2c0d41392b1cad5f642d311fdadafa81\n",
                        "  Stored in directory: /tmp/pip-ephem-wheel-cache-cyi1hs0q/wheels/42/68/45/c63edff61c292f2dfd4df4ef6522dcbecc603e7af82813c1d7\n",
                        "Successfully built diffusers transformers\n",
                        "Installing collected packages: tokenizers, mypy-extensions, typing-inspect, torch, ftfy, triton, torchvision, pyre-extensions, huggingface-hub, accelerate, xformers, transformers, diffusers\n",
                        "  Attempting uninstall: torch\n",
                        "    Found existing installation: torch 1.13.1+cu116\n",
                        "    Uninstalling torch-1.13.1+cu116:\n",
                        "      Successfully uninstalled torch-1.13.1+cu116\n",
                        "  Attempting uninstall: torchvision\n",
                        "    Found existing installation: torchvision 0.14.1+cu116\n",
                        "    Uninstalling torchvision-0.14.1+cu116:\n",
                        "      Successfully uninstalled torchvision-0.14.1+cu116\n",
                        "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
                        "torchtext 0.14.1 requires torch==1.13.1, but you have torch 1.12.1+cu113 which is incompatible.\n",
                        "torchaudio 0.13.1+cu116 requires torch==1.13.1, but you have torch 1.12.1+cu113 which is incompatible.\u001b[0m\u001b[31m\n",
                        "\u001b[0mSuccessfully installed accelerate-0.12.0 diffusers-0.13.0.dev0 ftfy-6.1.1 huggingface-hub-0.12.0 mypy-extensions-0.4.3 pyre-extensions-0.0.23 tokenizers-0.13.2 torch-1.12.1+cu113 torchvision-0.13.1+cu113 transformers-4.27.0.dev0 triton-2.0.0.dev20220701 typing-inspect-0.8.0 xformers-0.0.15.dev0+4c06c79.d20221205\n",
                        "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
                        "Collecting gradio==3.17.0\n",
                        "  Downloading gradio-3.17.0-py3-none-any.whl (14.2 MB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m14.2/14.2 MB\u001b[0m \u001b[31m64.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: typing-extensions in /usr/local/lib/python3.8/dist-packages (from gradio==3.17.0) (4.4.0)\n",
                        "Requirement already satisfied: altair>=4.2.0 in /usr/local/lib/python3.8/dist-packages (from gradio==3.17.0) (4.2.0)\n",
                        "Requirement already satisfied: markupsafe in /usr/local/lib/python3.8/dist-packages (from gradio==3.17.0) (2.0.1)\n",
                        "Requirement already satisfied: aiohttp in /usr/local/lib/python3.8/dist-packages (from gradio==3.17.0) (3.8.3)\n",
                        "Collecting httpx\n",
                        "  Downloading httpx-0.23.3-py3-none-any.whl (71 kB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m71.5/71.5 KB\u001b[0m \u001b[31m3.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: fsspec in /usr/local/lib/python3.8/dist-packages (from gradio==3.17.0) (2022.11.0)\n",
                        "Requirement already satisfied: requests in /usr/local/lib/python3.8/dist-packages (from gradio==3.17.0) (2.25.1)\n",
                        "Collecting pydub\n",
                        "  Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n",
                        "Requirement already satisfied: numpy in /usr/local/lib/python3.8/dist-packages (from gradio==3.17.0) (1.21.6)\n",
                        "Collecting markdown-it-py[linkify,plugins]\n",
                        "  Downloading markdown_it_py-2.1.0-py3-none-any.whl (84 kB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m84.5/84.5 KB\u001b[0m \u001b[31m11.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hCollecting fastapi\n",
                        "  Downloading fastapi-0.89.1-py3-none-any.whl (55 kB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m55.8/55.8 KB\u001b[0m \u001b[31m9.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hCollecting ffmpy\n",
                        "  Downloading ffmpy-0.3.0.tar.gz (4.8 kB)\n",
                        "  Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
                        "Collecting python-multipart\n",
                        "  Downloading python-multipart-0.0.5.tar.gz (32 kB)\n",
                        "  Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
                        "Requirement already satisfied: pillow in /usr/local/lib/python3.8/dist-packages (from gradio==3.17.0) (7.1.2)\n",
                        "Requirement already satisfied: pandas in /usr/local/lib/python3.8/dist-packages (from gradio==3.17.0) (1.3.5)\n",
                        "Collecting pycryptodome\n",
                        "  Downloading pycryptodome-3.17-cp35-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.1/2.1 MB\u001b[0m \u001b[31m84.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hCollecting websockets>=10.0\n",
                        "  Downloading websockets-10.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (106 kB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m107.0/107.0 KB\u001b[0m \u001b[31m13.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: matplotlib in /usr/local/lib/python3.8/dist-packages (from gradio==3.17.0) (3.2.2)\n",
                        "Requirement already satisfied: pydantic in /usr/local/lib/python3.8/dist-packages (from gradio==3.17.0) (1.10.4)\n",
                        "Collecting uvicorn\n",
                        "  Downloading uvicorn-0.20.0-py3-none-any.whl (56 kB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m56.9/56.9 KB\u001b[0m \u001b[31m8.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: jinja2 in /usr/local/lib/python3.8/dist-packages (from gradio==3.17.0) (2.11.3)\n",
                        "Collecting orjson\n",
                        "  Downloading orjson-3.8.5-cp38-cp38-manylinux_2_28_x86_64.whl (140 kB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m140.6/140.6 KB\u001b[0m \u001b[31m15.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: pyyaml in /usr/local/lib/python3.8/dist-packages (from gradio==3.17.0) (6.0)\n",
                        "Collecting aiofiles\n",
                        "  Downloading aiofiles-22.1.0-py3-none-any.whl (14 kB)\n",
                        "Requirement already satisfied: entrypoints in /usr/local/lib/python3.8/dist-packages (from altair>=4.2.0->gradio==3.17.0) (0.4)\n",
                        "Requirement already satisfied: jsonschema>=3.0 in /usr/local/lib/python3.8/dist-packages (from altair>=4.2.0->gradio==3.17.0) (4.3.3)\n",
                        "Requirement already satisfied: toolz in /usr/local/lib/python3.8/dist-packages (from altair>=4.2.0->gradio==3.17.0) (0.12.0)\n",
                        "Requirement already satisfied: pytz>=2017.3 in /usr/local/lib/python3.8/dist-packages (from pandas->gradio==3.17.0) (2022.7)\n",
                        "Requirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.8/dist-packages (from pandas->gradio==3.17.0) (2.8.2)\n",
                        "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.8/dist-packages (from aiohttp->gradio==3.17.0) (1.8.2)\n",
                        "Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.8/dist-packages (from aiohttp->gradio==3.17.0) (1.3.1)\n",
                        "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.8/dist-packages (from aiohttp->gradio==3.17.0) (6.0.4)\n",
                        "Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.8/dist-packages (from aiohttp->gradio==3.17.0) (4.0.2)\n",
                        "Requirement already satisfied: charset-normalizer<3.0,>=2.0 in /usr/local/lib/python3.8/dist-packages (from aiohttp->gradio==3.17.0) (2.1.1)\n",
                        "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.8/dist-packages (from aiohttp->gradio==3.17.0) (22.2.0)\n",
                        "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.8/dist-packages (from aiohttp->gradio==3.17.0) (1.3.3)\n",
                        "Collecting starlette==0.22.0\n",
                        "  Downloading starlette-0.22.0-py3-none-any.whl (64 kB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m64.3/64.3 KB\u001b[0m \u001b[31m7.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hCollecting anyio<5,>=3.4.0\n",
                        "  Downloading anyio-3.6.2-py3-none-any.whl (80 kB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m80.6/80.6 KB\u001b[0m \u001b[31m10.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hCollecting sniffio\n",
                        "  Downloading sniffio-1.3.0-py3-none-any.whl (10 kB)\n",
                        "Collecting rfc3986[idna2008]<2,>=1.3\n",
                        "  Downloading rfc3986-1.5.0-py2.py3-none-any.whl (31 kB)\n",
                        "Collecting httpcore<0.17.0,>=0.15.0\n",
                        "  Downloading httpcore-0.16.3-py3-none-any.whl (69 kB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m69.6/69.6 KB\u001b[0m \u001b[31m10.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: certifi in /usr/local/lib/python3.8/dist-packages (from httpx->gradio==3.17.0) (2022.12.7)\n",
                        "Collecting mdurl~=0.1\n",
                        "  Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)\n",
                        "Collecting linkify-it-py~=1.0\n",
                        "  Downloading linkify_it_py-1.0.3-py3-none-any.whl (19 kB)\n",
                        "Collecting mdit-py-plugins\n",
                        "  Downloading mdit_py_plugins-0.3.3-py3-none-any.whl (50 kB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m50.5/50.5 KB\u001b[0m \u001b[31m7.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.8/dist-packages (from matplotlib->gradio==3.17.0) (0.11.0)\n",
                        "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.8/dist-packages (from matplotlib->gradio==3.17.0) (3.0.9)\n",
                        "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.8/dist-packages (from matplotlib->gradio==3.17.0) (1.4.4)\n",
                        "Requirement already satisfied: six>=1.4.0 in /usr/local/lib/python3.8/dist-packages (from python-multipart->gradio==3.17.0) (1.15.0)\n",
                        "Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.8/dist-packages (from requests->gradio==3.17.0) (2.10)\n",
                        "Requirement already satisfied: chardet<5,>=3.0.2 in /usr/local/lib/python3.8/dist-packages (from requests->gradio==3.17.0) (4.0.0)\n",
                        "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.8/dist-packages (from requests->gradio==3.17.0) (1.24.3)\n",
                        "Collecting h11>=0.8\n",
                        "  Downloading h11-0.14.0-py3-none-any.whl (58 kB)\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 KB\u001b[0m \u001b[31m9.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25hRequirement already satisfied: click>=7.0 in /usr/local/lib/python3.8/dist-packages (from uvicorn->gradio==3.17.0) (7.1.2)\n",
                        "Requirement already satisfied: importlib-resources>=1.4.0 in /usr/local/lib/python3.8/dist-packages (from jsonschema>=3.0->altair>=4.2.0->gradio==3.17.0) (5.10.2)\n",
                        "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /usr/local/lib/python3.8/dist-packages (from jsonschema>=3.0->altair>=4.2.0->gradio==3.17.0) (0.19.3)\n",
                        "Collecting uc-micro-py\n",
                        "  Downloading uc_micro_py-1.0.1-py3-none-any.whl (6.2 kB)\n",
                        "Requirement already satisfied: zipp>=3.1.0 in /usr/local/lib/python3.8/dist-packages (from importlib-resources>=1.4.0->jsonschema>=3.0->altair>=4.2.0->gradio==3.17.0) (3.11.0)\n",
                        "Building wheels for collected packages: ffmpy, python-multipart\n",
                        "  Building wheel for ffmpy (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
                        "  Created wheel for ffmpy: filename=ffmpy-0.3.0-py3-none-any.whl size=4711 sha256=cc445a748d7cb9057d3df2d5b164d702015322b8fbec0c4598c38005773ec336\n",
                        "  Stored in directory: /root/.cache/pip/wheels/ff/5b/59/913b443e7369dc04b61f607a746b6f7d83fb65e2e19fcc958d\n",
                        "  Building wheel for python-multipart (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
                        "  Created wheel for python-multipart: filename=python_multipart-0.0.5-py3-none-any.whl size=31678 sha256=9e778e28cf21d255a73594882d4aaacd6e151ed169df72fdfa2a30c8f5c8b1f8\n",
                        "  Stored in directory: /root/.cache/pip/wheels/9e/fc/1c/cf980e6413d3ee8e70cd8f39e2366b0f487e3e221aeb452eb0\n",
                        "Successfully built ffmpy python-multipart\n",
                        "Installing collected packages: rfc3986, pydub, ffmpy, websockets, uc-micro-py, sniffio, python-multipart, pycryptodome, orjson, mdurl, h11, aiofiles, uvicorn, markdown-it-py, linkify-it-py, anyio, starlette, mdit-py-plugins, httpcore, httpx, fastapi, gradio\n",
                        "Successfully installed aiofiles-22.1.0 anyio-3.6.2 fastapi-0.89.1 ffmpy-0.3.0 gradio-3.17.0 h11-0.14.0 httpcore-0.16.3 httpx-0.23.3 linkify-it-py-1.0.3 markdown-it-py-2.1.0 mdit-py-plugins-0.3.3 mdurl-0.1.2 orjson-3.8.5 pycryptodome-3.17 pydub-0.25.1 python-multipart-0.0.5 rfc3986-1.5.0 sniffio-1.3.0 starlette-0.22.0 uc-micro-py-1.0.1 uvicorn-0.20.0 websockets-10.4\n",
                        "Found existing installation: xformers 0.0.15.dev0+4c06c79.d20221205\n",
                        "Uninstalling xformers-0.0.15.dev0+4c06c79.d20221205:\n",
                        "  Successfully uninstalled xformers-0.0.15.dev0+4c06c79.d20221205\n",
                        "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m103.0/103.0 MB\u001b[0m \u001b[31m3.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
                        "\u001b[?25h",
                    ],
                }
            ],
            "source": [
                "!git clone https://huggingface.co/spaces/AdamOswald1/finetuned_diffusionl\n",
                "%cd finetuned_diffusionl/\n",
                "!pip install -r requirements.txt\n",
                "!pip install gradio==3.17.1\n",
                "\n",
                "!pip uninstall -y xformers\n",
                "!pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.15/xformers-0.0.15.dev0+1515f77.d20221130-cp38-cp38-linux_x86_64.whl",
            ],
        },
        {
            "cell_type": "markdown",
            "source": [
                "### 2. Run\n",
                "\n",
                "Expand this cell and run it. After it finishes loading, **open the generated gradio public link** (e.g. https://xxxx.gradio.app) in the output.\n",
                "\n",
                "When running in a colab, models need to be downloaded the first time you use them, so give it some time.",
            ],
            "metadata": {"id": "g51-cBLlTsO4"},
        },
        {
            "cell_type": "code",
            "source": ["!python app.py"],
            "metadata": {"id": "dMhWUqKdNzn3"},
            "execution_count": null,
            "outputs": [],
        },
    ],
}