dgoot commited on
Commit
e80303a
·
1 Parent(s): fbb30c1

Move pipeline to CUDA in ZeroGPU function

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -52,7 +52,7 @@ def generate(
52
  )
53
 
54
  logger.debug(f"Loading pipeline: {dict(model=model)}")
55
- pipe = pipeline_type.from_pretrained(model).to("cuda")
56
 
57
  logger.debug(f"Generating image: {dict(prompt=prompt)}")
58
  additional_args = (
@@ -62,7 +62,7 @@ def generate(
62
  gpu_runner = gpu_3min if model == "timbrooks/instruct-pix2pix" else gpu
63
 
64
  images = gpu_runner(
65
- lambda: pipe(
66
  prompt=prompt,
67
  image=init_image,
68
  callback_on_step_end=progress_callback,
 
52
  )
53
 
54
  logger.debug(f"Loading pipeline: {dict(model=model)}")
55
+ pipe = pipeline_type.from_pretrained(model)
56
 
57
  logger.debug(f"Generating image: {dict(prompt=prompt)}")
58
  additional_args = (
 
62
  gpu_runner = gpu_3min if model == "timbrooks/instruct-pix2pix" else gpu
63
 
64
  images = gpu_runner(
65
+ lambda: pipe.to("cuda")(
66
  prompt=prompt,
67
  image=init_image,
68
  callback_on_step_end=progress_callback,