Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import numpy as np
|
|
| 6 |
import spaces
|
| 7 |
import torch
|
| 8 |
import random
|
| 9 |
-
from PIL import Image
|
| 10 |
from typing import Iterable
|
| 11 |
from gradio.themes import Soft
|
| 12 |
from gradio.themes.utils import colors, fonts, sizes
|
|
@@ -111,7 +111,7 @@ except Exception as e:
|
|
| 111 |
MAX_SEED = np.iinfo(np.int32).max
|
| 112 |
|
| 113 |
|
| 114 |
-
def choose_safe_canvas_size(image, max_long_side=768, max_area=768 * 768, multiple=
|
| 115 |
w, h = image.size
|
| 116 |
area = w * h
|
| 117 |
|
|
@@ -188,6 +188,7 @@ def process_and_concat(images, prompt, seed, randomize_seed, guidance_scale, ste
|
|
| 188 |
orig_image = path_or_img.convert("RGB")
|
| 189 |
else:
|
| 190 |
orig_image = Image.open(path_or_img.name).convert("RGB")
|
|
|
|
| 191 |
except Exception as e:
|
| 192 |
raise gr.Error(f"Could not load image: {e}")
|
| 193 |
|
|
|
|
| 6 |
import spaces
|
| 7 |
import torch
|
| 8 |
import random
|
| 9 |
+
from PIL import Image, ImageOps
|
| 10 |
from typing import Iterable
|
| 11 |
from gradio.themes import Soft
|
| 12 |
from gradio.themes.utils import colors, fonts, sizes
|
|
|
|
| 111 |
MAX_SEED = np.iinfo(np.int32).max
|
| 112 |
|
| 113 |
|
| 114 |
+
def choose_safe_canvas_size(image, max_long_side=768, max_area=768 * 768, multiple=64):
|
| 115 |
w, h = image.size
|
| 116 |
area = w * h
|
| 117 |
|
|
|
|
| 188 |
orig_image = path_or_img.convert("RGB")
|
| 189 |
else:
|
| 190 |
orig_image = Image.open(path_or_img.name).convert("RGB")
|
| 191 |
+
orig_image = ImageOps.exif_transpose(orig_image).convert("RGB")
|
| 192 |
except Exception as e:
|
| 193 |
raise gr.Error(f"Could not load image: {e}")
|
| 194 |
|