tedoaba commited on
Commit
7f1109c
·
verified ·
1 Parent(s): ade161f

Update app.py

Browse files

Added a code to ensure the code works for .png image types

Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -53,6 +53,10 @@ adapter.to(device)
53
  clip_model, _ = clip.load("ViT-B/32", device=device)
54
 
55
  def manipulate(input_image, caption):
 
 
 
 
56
  aligned_image = run_alignment(input_image)
57
  input_image = input_transforms(aligned_image)
58
  input_image = input_image.unsqueeze(0)
 
53
  clip_model, _ = clip.load("ViT-B/32", device=device)
54
 
55
  def manipulate(input_image, caption):
56
+ if not isinstance(input_image, Image.Image):
57
+ input_image = Image.open(input_image).convert('RGB')
58
+ else:
59
+ input_image = input_image.convert('RGB')
60
  aligned_image = run_alignment(input_image)
61
  input_image = input_transforms(aligned_image)
62
  input_image = input_image.unsqueeze(0)