Spaces:
Runtime error
Runtime error
Commit
•
22175fc
1
Parent(s):
aea07e3
up
Browse files- .gitignore +0 -1
- app.py +13 -4
- gradio_cached_examples/17/log.csv +7 -0
- gradio_cached_examples/17/output/tmp51idisi8.png +0 -0
- gradio_cached_examples/17/output/tmp_smsd0eq.png +0 -0
- gradio_cached_examples/17/output/tmpmmt1sbea.png +0 -0
- gradio_cached_examples/17/output/tmprdh4k7n4.png +0 -0
- gradio_cached_examples/17/output/tmpsnz6ewc7.png +0 -0
- gradio_cached_examples/17/output/tmpw7cik_mi.png +0 -0
.gitignore
CHANGED
@@ -1,2 +1 @@
|
|
1 |
-
gradio_cached_examples
|
2 |
flagged
|
|
|
|
|
1 |
flagged
|
app.py
CHANGED
@@ -2,20 +2,29 @@ import gradio as gr
|
|
2 |
import torch
|
3 |
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, UniPCMultistepScheduler
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
controlnet = ControlNetModel.from_pretrained(
|
6 |
"williamberman/controlnet-fill50k",
|
7 |
-
torch_dtype=
|
8 |
)
|
9 |
|
10 |
pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
11 |
"runwayml/stable-diffusion-v1-5",
|
12 |
controlnet=controlnet,
|
13 |
safety_checker=None,
|
14 |
-
torch_dtype=
|
15 |
)
|
16 |
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
17 |
-
|
18 |
-
|
|
|
|
|
19 |
|
20 |
def inference(prompt, image, seed=-1):
|
21 |
if seed == -1:
|
|
|
2 |
import torch
|
3 |
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, UniPCMultistepScheduler
|
4 |
|
5 |
+
use_cuda = torch.cuda.is_available()
|
6 |
+
|
7 |
+
if use_cuda:
|
8 |
+
dtype = torch.float16
|
9 |
+
else:
|
10 |
+
dtype = torch.float32
|
11 |
+
|
12 |
controlnet = ControlNetModel.from_pretrained(
|
13 |
"williamberman/controlnet-fill50k",
|
14 |
+
torch_dtype=dtype
|
15 |
)
|
16 |
|
17 |
pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
18 |
"runwayml/stable-diffusion-v1-5",
|
19 |
controlnet=controlnet,
|
20 |
safety_checker=None,
|
21 |
+
torch_dtype=dtype
|
22 |
)
|
23 |
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
24 |
+
|
25 |
+
if use_cuda:
|
26 |
+
pipe.enable_xformers_memory_efficient_attention()
|
27 |
+
pipe.enable_model_cpu_offload()
|
28 |
|
29 |
def inference(prompt, image, seed=-1):
|
30 |
if seed == -1:
|
gradio_cached_examples/17/log.csv
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
output,flag,username,timestamp
|
2 |
+
output/tmpmmt1sbea.png,,,2023-03-13 05:32:01.492640
|
3 |
+
output/tmp51idisi8.png,,,2023-03-13 05:32:05.214562
|
4 |
+
output/tmprdh4k7n4.png,,,2023-03-13 05:32:08.741490
|
5 |
+
output/tmpw7cik_mi.png,,,2023-03-13 05:32:12.270382
|
6 |
+
output/tmpsnz6ewc7.png,,,2023-03-13 05:32:15.736019
|
7 |
+
output/tmp_smsd0eq.png,,,2023-03-13 05:32:19.265256
|
gradio_cached_examples/17/output/tmp51idisi8.png
ADDED
![]() |
gradio_cached_examples/17/output/tmp_smsd0eq.png
ADDED
![]() |
gradio_cached_examples/17/output/tmpmmt1sbea.png
ADDED
![]() |
gradio_cached_examples/17/output/tmprdh4k7n4.png
ADDED
![]() |
gradio_cached_examples/17/output/tmpsnz6ewc7.png
ADDED
![]() |
gradio_cached_examples/17/output/tmpw7cik_mi.png
ADDED
![]() |