Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -68,9 +68,12 @@ def create_image(image_pil,
|
|
| 68 |
}
|
| 69 |
#pipe.set_ip_adapter_scale(scale) ## Waiting for SD3 Diffuser integration
|
| 70 |
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
print("starting inference")
|
| 74 |
image = pipe(
|
| 75 |
width=1024,
|
| 76 |
height=1024,
|
|
@@ -83,12 +86,12 @@ def create_image(image_pil,
|
|
| 83 |
ipadapter_scale=scale,
|
| 84 |
).images[0]
|
| 85 |
|
| 86 |
-
|
| 87 |
if torch.cuda.is_available():
|
| 88 |
torch.cuda.empty_cache()
|
| 89 |
gc.collect()
|
| 90 |
|
| 91 |
-
|
| 92 |
print(image)
|
| 93 |
|
| 94 |
return image
|
|
|
|
| 68 |
}
|
| 69 |
#pipe.set_ip_adapter_scale(scale) ## Waiting for SD3 Diffuser integration
|
| 70 |
|
| 71 |
+
if hasattr(image_pil, 'read'): # If it's a file
|
| 72 |
+
style_image = Image.open(image_pil).convert('RGB')
|
| 73 |
+
else: # If it's already a PIL Image
|
| 74 |
+
style_image = image_pil.convert('RGB')
|
| 75 |
+
|
| 76 |
|
|
|
|
| 77 |
image = pipe(
|
| 78 |
width=1024,
|
| 79 |
height=1024,
|
|
|
|
| 86 |
ipadapter_scale=scale,
|
| 87 |
).images[0]
|
| 88 |
|
| 89 |
+
|
| 90 |
if torch.cuda.is_available():
|
| 91 |
torch.cuda.empty_cache()
|
| 92 |
gc.collect()
|
| 93 |
|
| 94 |
+
|
| 95 |
print(image)
|
| 96 |
|
| 97 |
return image
|