Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -149,6 +149,19 @@ def infer(use_custom_model, model_name, weight_name, custom_lora_weight, image_i
|
|
| 149 |
image = image[:, :, None]
|
| 150 |
image = np.concatenate([image, image, image], axis=2)
|
| 151 |
image = Image.fromarray(image)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
|
| 153 |
if use_custom_model:
|
| 154 |
|
|
|
|
| 149 |
image = image[:, :, None]
|
| 150 |
image = np.concatenate([image, image, image], axis=2)
|
| 151 |
image = Image.fromarray(image)
|
| 152 |
+
|
| 153 |
+
if preprocessor == "lineart":
|
| 154 |
+
image = Image.open(image_in)
|
| 155 |
+
|
| 156 |
+
# Convert the image to a NumPy array
|
| 157 |
+
image = np.array(image)
|
| 158 |
+
|
| 159 |
+
# (Optional) If you need to ensure the image is in RGB format, convert it
|
| 160 |
+
image = image.convert("RGB")
|
| 161 |
+
image = np.array(image)
|
| 162 |
+
|
| 163 |
+
# Convert the NumPy array back to a PIL Image (if you need to do further PIL-based processing)
|
| 164 |
+
image = Image.fromarray(image)
|
| 165 |
|
| 166 |
if use_custom_model:
|
| 167 |
|