alfredplpl commited on
Commit
5810cdb
1 Parent(s): 6506b9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -8
app.py CHANGED
@@ -42,6 +42,7 @@ upscaler = StableDiffusionLatentUpscalePipeline.from_pretrained("alfredplpl/x2-l
42
  if torch.cuda.is_available():
43
  pipe = pipe.to("cuda")
44
  pipe_i2i = pipe_i2i.to("cuda")
 
45
 
46
  def error_str(error, title="Error"):
47
  return f"""#### {title}
@@ -157,8 +158,6 @@ def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator,sup
157
  height = height,
158
  output_type="latent",
159
  generator = generator).images
160
- pipe=pipe.to("cpu")
161
- upscaler=upscaler.to("cuda")
162
  result = upscaler(
163
  prompt=prompt,
164
  negative_prompt = neg_prompt,
@@ -167,8 +166,6 @@ def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator,sup
167
  guidance_scale=0,
168
  generator=generator,
169
  )
170
- pipe=pipe.to("cuda")
171
- upscaler=upscaler.to("cpu")
172
  else:
173
  result = pipe(
174
  prompt,
@@ -197,8 +194,6 @@ def img_to_img(prompt, neg_prompt, img, strength, guidance, steps, width, height
197
  #height = height,
198
  output_type="latent",
199
  generator = generator).images
200
- pipe=pipe.to("cpu")
201
- upscaler=upscaler.to("cuda")
202
  result = upscaler(
203
  prompt=prompt,
204
  negative_prompt = neg_prompt,
@@ -207,8 +202,6 @@ def img_to_img(prompt, neg_prompt, img, strength, guidance, steps, width, height
207
  guidance_scale=0,
208
  generator=generator,
209
  )
210
- pipe=pipe.to("cuda")
211
- upscaler=upscaler.to("cpu")
212
  else:
213
  result = pipe_i2i(
214
  prompt,
 
42
  if torch.cuda.is_available():
43
  pipe = pipe.to("cuda")
44
  pipe_i2i = pipe_i2i.to("cuda")
45
+ upscaler=upscaler.to("cuda")
46
 
47
  def error_str(error, title="Error"):
48
  return f"""#### {title}
 
158
  height = height,
159
  output_type="latent",
160
  generator = generator).images
 
 
161
  result = upscaler(
162
  prompt=prompt,
163
  negative_prompt = neg_prompt,
 
166
  guidance_scale=0,
167
  generator=generator,
168
  )
 
 
169
  else:
170
  result = pipe(
171
  prompt,
 
194
  #height = height,
195
  output_type="latent",
196
  generator = generator).images
 
 
197
  result = upscaler(
198
  prompt=prompt,
199
  negative_prompt = neg_prompt,
 
202
  guidance_scale=0,
203
  generator=generator,
204
  )
 
 
205
  else:
206
  result = pipe_i2i(
207
  prompt,