ford442 commited on
Commit
9383295
·
verified ·
1 Parent(s): 2e254d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -203,6 +203,9 @@ def infer(
203
  # output='latent',
204
  generator=generator
205
  ).images[0]
 
 
 
206
  else:
207
  print('-- generating image --')
208
  #with torch.no_grad():
@@ -221,20 +224,17 @@ def infer(
221
  max_sequence_length=512
222
  ).images[0]
223
  print('-- got image --')
224
-
225
  sd35_image_image = pipe.vae.decode(sd_image / 0.18215).sample
226
  sd35_image = sd35_image.cpu().permute(0, 2, 3, 1).float().detach().numpy()
227
  sd35_image = (sd35_image * 255).round().astype("uint8")
228
  image_pil = Image.fromarray(sd35_image[0])
229
- sd35_path = f"tst_rv_{seed}.png"
230
  image_pil.save(sd35_path,optimize=False,compress_level=0)
231
  upload_to_ftp(sd35_path)
232
 
233
-
234
  #sd35_path = f"sd35_{seed}.png"
235
  #sd_image.save(sd35_path,optimize=False,compress_level=0)
236
  #upload_to_ftp(sd35_path)
237
-
238
  # Convert the generated image to a tensor
239
  #generated_image_tensor = torch.tensor([np.array(sd_image).transpose(2, 0, 1)]).to('cuda') / 255.0
240
  # Encode the generated image into latents
@@ -253,7 +253,7 @@ def infer(
253
  image=sd_image,
254
  generator=generator,
255
  ).images[0]
256
- refine_path = f"sd35m_refine_{seed}.png"
257
  refine.save(refine_path,optimize=False,compress_level=0)
258
  upload_to_ftp(refine_path)
259
  return refine, seed, enhanced_prompt
 
203
  # output='latent',
204
  generator=generator
205
  ).images[0]
206
+ rv_path = f"sd35_{seed}.png"
207
+ sd_image[0].save(rv_path,optimize=False,compress_level=0)
208
+ upload_to_ftp(rv_path)
209
  else:
210
  print('-- generating image --')
211
  #with torch.no_grad():
 
224
  max_sequence_length=512
225
  ).images[0]
226
  print('-- got image --')
 
227
  sd35_image_image = pipe.vae.decode(sd_image / 0.18215).sample
228
  sd35_image = sd35_image.cpu().permute(0, 2, 3, 1).float().detach().numpy()
229
  sd35_image = (sd35_image * 255).round().astype("uint8")
230
  image_pil = Image.fromarray(sd35_image[0])
231
+ sd35_path = f"sd35_{seed}.png"
232
  image_pil.save(sd35_path,optimize=False,compress_level=0)
233
  upload_to_ftp(sd35_path)
234
 
 
235
  #sd35_path = f"sd35_{seed}.png"
236
  #sd_image.save(sd35_path,optimize=False,compress_level=0)
237
  #upload_to_ftp(sd35_path)
 
238
  # Convert the generated image to a tensor
239
  #generated_image_tensor = torch.tensor([np.array(sd_image).transpose(2, 0, 1)]).to('cuda') / 255.0
240
  # Encode the generated image into latents
 
253
  image=sd_image,
254
  generator=generator,
255
  ).images[0]
256
+ refine_path = f"sd35_refine_{seed}.png"
257
  refine.save(refine_path,optimize=False,compress_level=0)
258
  upload_to_ftp(refine_path)
259
  return refine, seed, enhanced_prompt