Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
import torch
|
@@ -11,12 +49,12 @@ model_id = "CompVis/stable-diffusion-v1-4"
|
|
11 |
device = "cuda"
|
12 |
|
13 |
#If you are running this code locally, you need to either do a 'huggingface-cli login` or paste your User Access Token from here https://huggingface.co/settings/tokens into the use_auth_token field below.
|
14 |
-
pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=
|
15 |
pipe = pipe.to(device)
|
16 |
torch.backends.cudnn.benchmark = True
|
17 |
|
18 |
#When running locally, you won`t have access to this, so you can remove this part
|
19 |
-
word_list_dataset = load_dataset("stabilityai/word-list", data_files="list.txt", use_auth_token=
|
20 |
word_list = word_list_dataset["train"]['text']
|
21 |
|
22 |
def infer(prompt, samples, steps, scale, seed):
|
@@ -299,4 +337,4 @@ Despite how impressive being able to turn text into image is, beware to the fact
|
|
299 |
"""
|
300 |
)
|
301 |
|
302 |
-
block.queue(max_size=25).launch()
|
|
|
1 |
+
Hugging Face's logo
|
2 |
+
Hugging Face
|
3 |
+
Search models, datasets, users...
|
4 |
+
Models
|
5 |
+
Datasets
|
6 |
+
Spaces
|
7 |
+
Docs
|
8 |
+
Solutions
|
9 |
+
Pricing
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
Spaces:
|
14 |
+
|
15 |
+
stabilityai
|
16 |
+
/
|
17 |
+
stable-diffusion Copied
|
18 |
+
like
|
19 |
+
1.75k
|
20 |
+
App
|
21 |
+
Files and versions
|
22 |
+
Community
|
23 |
+
204
|
24 |
+
stable-diffusion
|
25 |
+
/
|
26 |
+
app.py
|
27 |
+
apolinario's picture
|
28 |
+
apolinario
|
29 |
+
Add performance upgrades
|
30 |
+
90ca23c
|
31 |
+
1 day ago
|
32 |
+
raw
|
33 |
+
history
|
34 |
+
blame
|
35 |
+
contribute
|
36 |
+
delete
|
37 |
+
Safe
|
38 |
+
12.5 kB
|
39 |
import gradio as gr
|
40 |
|
41 |
import torch
|
|
|
49 |
device = "cuda"
|
50 |
|
51 |
#If you are running this code locally, you need to either do a 'huggingface-cli login` or paste your User Access Token from here https://huggingface.co/settings/tokens into the use_auth_token field below.
|
52 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True, revision="fp16", torch_dtype=torch.float16)
|
53 |
pipe = pipe.to(device)
|
54 |
torch.backends.cudnn.benchmark = True
|
55 |
|
56 |
#When running locally, you won`t have access to this, so you can remove this part
|
57 |
+
word_list_dataset = load_dataset("stabilityai/word-list", data_files="list.txt", use_auth_token=True)
|
58 |
word_list = word_list_dataset["train"]['text']
|
59 |
|
60 |
def infer(prompt, samples, steps, scale, seed):
|
|
|
337 |
"""
|
338 |
)
|
339 |
|
340 |
+
block.queue(max_size=25).launch()
|