Spaces:
Build error
Build error
Update app.py
Browse filesAdded a code to ensure the code works for .png image types
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)
|