Spaces:
Running
Running
initialize controlnet with decorator
Browse files
app.py
CHANGED
@@ -10,11 +10,9 @@ from game_of_life import GameOfLife
|
|
10 |
from utils import resize_image, generate_image_from_grid
|
11 |
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
print(f"Using {device=}")
|
17 |
-
controlnet = QRControlNet(device=device)
|
18 |
|
19 |
|
20 |
def generate_all_images(
|
@@ -113,6 +111,13 @@ def generate(
|
|
113 |
return path_gol_controlnet, path_gol_gif
|
114 |
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
source_image = gr.Image(label="Source Image", type="pil", value="sky-gol-image.jpeg")
|
117 |
|
118 |
output_controlnet = gr.Image(label="ControlNet Game of Life")
|
|
|
10 |
from utils import resize_image, generate_image_from_grid
|
11 |
|
12 |
|
13 |
+
@spaces.gpu
|
14 |
+
def init_controlnet(device: str) -> QRControlNet:
|
15 |
+
return QRControlNet(device=device)
|
|
|
|
|
16 |
|
17 |
|
18 |
def generate_all_images(
|
|
|
111 |
return path_gol_controlnet, path_gol_gif
|
112 |
|
113 |
|
114 |
+
device = "cuda"
|
115 |
+
# device = "mps"
|
116 |
+
# device = "cpu"
|
117 |
+
print(f"Using {device=}")
|
118 |
+
controlnet = init_controlnet()
|
119 |
+
|
120 |
+
|
121 |
source_image = gr.Image(label="Source Image", type="pil", value="sky-gol-image.jpeg")
|
122 |
|
123 |
output_controlnet = gr.Image(label="ControlNet Game of Life")
|