Spaces:
Runtime error
Runtime error
forgot to remove the hint/mask dict
Browse files
app.py
CHANGED
|
@@ -34,7 +34,7 @@ if _model.failed != False:
|
|
| 34 |
def generate(
|
| 35 |
prompt = 'An elderly man having a great time in the park.',
|
| 36 |
neg_prompt = '',
|
| 37 |
-
image =
|
| 38 |
inference_steps = 20,
|
| 39 |
cfg = 12.0,
|
| 40 |
seed = 0,
|
|
@@ -52,27 +52,17 @@ def generate(
|
|
| 52 |
if seed < 0:
|
| 53 |
seed = -seed
|
| 54 |
inference_steps = int(inference_steps)
|
| 55 |
-
|
| 56 |
-
hint_image = image['image']
|
| 57 |
-
mask_image = image['mask']
|
| 58 |
-
else:
|
| 59 |
-
hint_image = None
|
| 60 |
-
mask_image = None
|
| 61 |
if hint_image is not None:
|
| 62 |
if hint_image.mode != 'RGB':
|
| 63 |
hint_image = hint_image.convert('RGB')
|
| 64 |
if hint_image.size != (width, height):
|
| 65 |
hint_image = ImageOps.fit(hint_image, (width, height), method = Image.Resampling.LANCZOS)
|
| 66 |
-
if mask_image is not None:
|
| 67 |
-
if mask_image.mode != 'L':
|
| 68 |
-
mask_image = mask_image.convert('L')
|
| 69 |
-
if mask_image.size != (width, height):
|
| 70 |
-
mask_image = ImageOps.fit(mask_image, (width, height), method = Image.Resampling.LANCZOS)
|
| 71 |
images = _model.generate(
|
| 72 |
prompt = [prompt] * _model.device_count,
|
| 73 |
neg_prompt = neg_prompt,
|
| 74 |
hint_image = hint_image,
|
| 75 |
-
mask_image =
|
| 76 |
inference_steps = inference_steps,
|
| 77 |
cfg = cfg,
|
| 78 |
height = height,
|
|
|
|
| 34 |
def generate(
|
| 35 |
prompt = 'An elderly man having a great time in the park.',
|
| 36 |
neg_prompt = '',
|
| 37 |
+
image = None,
|
| 38 |
inference_steps = 20,
|
| 39 |
cfg = 12.0,
|
| 40 |
seed = 0,
|
|
|
|
| 52 |
if seed < 0:
|
| 53 |
seed = -seed
|
| 54 |
inference_steps = int(inference_steps)
|
| 55 |
+
hint_image = image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
if hint_image is not None:
|
| 57 |
if hint_image.mode != 'RGB':
|
| 58 |
hint_image = hint_image.convert('RGB')
|
| 59 |
if hint_image.size != (width, height):
|
| 60 |
hint_image = ImageOps.fit(hint_image, (width, height), method = Image.Resampling.LANCZOS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
images = _model.generate(
|
| 62 |
prompt = [prompt] * _model.device_count,
|
| 63 |
neg_prompt = neg_prompt,
|
| 64 |
hint_image = hint_image,
|
| 65 |
+
mask_image = None,
|
| 66 |
inference_steps = inference_steps,
|
| 67 |
cfg = cfg,
|
| 68 |
height = height,
|