Handles HEIC
Browse files
app.py
CHANGED
|
@@ -7,10 +7,13 @@ import torch
|
|
| 7 |
import spaces
|
| 8 |
|
| 9 |
from diffusers import StableDiffusionXLInpaintPipeline
|
| 10 |
-
from PIL import Image
|
| 11 |
import PIL.ImageOps
|
|
|
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
| 14 |
|
| 15 |
if torch.cuda.is_available():
|
| 16 |
device = "cuda"
|
|
@@ -35,7 +38,7 @@ def toggle_debug(is_debug_mode):
|
|
| 35 |
def check(
|
| 36 |
source_img,
|
| 37 |
prompt,
|
| 38 |
-
uploaded_mask,
|
| 39 |
negative_prompt,
|
| 40 |
num_inference_steps,
|
| 41 |
guidance_scale,
|
|
@@ -56,7 +59,7 @@ def check(
|
|
| 56 |
def inpaint(
|
| 57 |
source_img,
|
| 58 |
prompt,
|
| 59 |
-
uploaded_mask,
|
| 60 |
negative_prompt,
|
| 61 |
num_inference_steps,
|
| 62 |
guidance_scale,
|
|
|
|
| 7 |
import spaces
|
| 8 |
|
| 9 |
from diffusers import StableDiffusionXLInpaintPipeline
|
| 10 |
+
from PIL import Image
|
| 11 |
import PIL.ImageOps
|
| 12 |
+
from pillow_heif import register_heif_opener
|
| 13 |
|
| 14 |
+
register_heif_opener()
|
| 15 |
+
|
| 16 |
+
max_64_bit_int = np.iinfo(np.int32).max
|
| 17 |
|
| 18 |
if torch.cuda.is_available():
|
| 19 |
device = "cuda"
|
|
|
|
| 38 |
def check(
|
| 39 |
source_img,
|
| 40 |
prompt,
|
| 41 |
+
uploaded_mask: Image.Image,
|
| 42 |
negative_prompt,
|
| 43 |
num_inference_steps,
|
| 44 |
guidance_scale,
|
|
|
|
| 59 |
def inpaint(
|
| 60 |
source_img,
|
| 61 |
prompt,
|
| 62 |
+
uploaded_mask: Image.Image,
|
| 63 |
negative_prompt,
|
| 64 |
num_inference_steps,
|
| 65 |
guidance_scale,
|