Commit
·
c88a186
1
Parent(s):
81115f7
Refactor FluxImg2ImgReq class to make image and strength attributes required
Browse files
app.py
CHANGED
|
@@ -117,15 +117,15 @@ class FluxReq(BaseModel):
|
|
| 117 |
|
| 118 |
|
| 119 |
class FluxImg2ImgReq(FluxReq):
|
| 120 |
-
image:
|
| 121 |
-
strength:
|
| 122 |
|
| 123 |
class Config:
|
| 124 |
arbitrary_types_allowed=True
|
| 125 |
|
| 126 |
|
| 127 |
class FluxInpaintReq(FluxImg2ImgReq):
|
| 128 |
-
mask_image:
|
| 129 |
|
| 130 |
class Config:
|
| 131 |
arbitrary_types_allowed=True
|
|
@@ -563,12 +563,13 @@ def generate_image(
|
|
| 563 |
mask_image = inpaint_image['layers'][0] if image else None
|
| 564 |
strength = float(inpaint_strength)
|
| 565 |
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
|
|
|
| 572 |
elif any([canny_image, pose_image, depth_image]):
|
| 573 |
base_args.controlnet_config = ControlNetReq(
|
| 574 |
controlnets=[],
|
|
|
|
| 117 |
|
| 118 |
|
| 119 |
class FluxImg2ImgReq(FluxReq):
|
| 120 |
+
image: Image.Image
|
| 121 |
+
strength: float = 1.0
|
| 122 |
|
| 123 |
class Config:
|
| 124 |
arbitrary_types_allowed=True
|
| 125 |
|
| 126 |
|
| 127 |
class FluxInpaintReq(FluxImg2ImgReq):
|
| 128 |
+
mask_image: Image.Image
|
| 129 |
|
| 130 |
class Config:
|
| 131 |
arbitrary_types_allowed=True
|
|
|
|
| 563 |
mask_image = inpaint_image['layers'][0] if image else None
|
| 564 |
strength = float(inpaint_strength)
|
| 565 |
|
| 566 |
+
if image and mask_image:
|
| 567 |
+
base_args = FluxInpaintReq(
|
| 568 |
+
**base_args.__dict__,
|
| 569 |
+
image=image,
|
| 570 |
+
mask_image=mask_image,
|
| 571 |
+
strength=strength
|
| 572 |
+
)
|
| 573 |
elif any([canny_image, pose_image, depth_image]):
|
| 574 |
base_args.controlnet_config = ControlNetReq(
|
| 575 |
controlnets=[],
|