jerpint commited on
Commit
d9006da
·
1 Parent(s): e4e8b82

debugging zero space

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -10,6 +10,7 @@ from game_of_life import GameOfLife
10
  from utils import resize_image, generate_image_from_grid
11
 
12
 
 
13
  def generate_all_images(
14
  gol_grids: list[np.array],
15
  source_image: Image,
@@ -22,6 +23,13 @@ def generate_all_images(
22
  guidance_scale: float,
23
  img_size: int,
24
  ):
 
 
 
 
 
 
 
25
 
26
  controlnet_conditioning_scale = float(controlnet_conditioning_scale)
27
  source_image = resize_image(source_image, resolution=img_size)
@@ -59,7 +67,6 @@ def make_gif(images: list[Image.Image], gif_path):
59
  return gif_path
60
 
61
 
62
- @spaces.GPU(duration=120)
63
  def generate(
64
  source_image,
65
  prompt,
@@ -106,13 +113,6 @@ def generate(
106
  return path_gol_controlnet, path_gol_gif
107
 
108
 
109
- device = "cuda"
110
- # device = "mps"
111
- # device = "cpu"
112
- print(f"Using {device=}")
113
- controlnet = QRControlNet(device=device)
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")
@@ -163,4 +163,4 @@ demo = gr.Interface(
163
  ],
164
  outputs=[output_controlnet, output_gol],
165
  )
166
- demo.launch()
 
10
  from utils import resize_image, generate_image_from_grid
11
 
12
 
13
+ @spaces.GPU(duration=120)
14
  def generate_all_images(
15
  gol_grids: list[np.array],
16
  source_image: Image,
 
23
  guidance_scale: float,
24
  img_size: int,
25
  ):
26
+ # device = "mps"
27
+ # device = "cpu"
28
+ device = "cuda"
29
+ print(f"Using {device=}")
30
+
31
+ # Initialize the controlnet (this can take a while the first time it's run)
32
+ controlnet = QRControlNet(device=device)
33
 
34
  controlnet_conditioning_scale = float(controlnet_conditioning_scale)
35
  source_image = resize_image(source_image, resolution=img_size)
 
67
  return gif_path
68
 
69
 
 
70
  def generate(
71
  source_image,
72
  prompt,
 
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")
 
163
  ],
164
  outputs=[output_controlnet, output_gol],
165
  )
166
+ demo.launch(debug=True)