Update app.py
Browse files
app.py
CHANGED
|
@@ -1073,7 +1073,7 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1073 |
# ===== CONTROLNET: MAPS ERSTELLEN =====
|
| 1074 |
print(f"📊 ControlNet Input Größe: {scaled_image.size}")
|
| 1075 |
|
| 1076 |
-
controlnet_maps = controlnet_processor.prepare_controlnet_maps(
|
| 1077 |
image=scaled_image,
|
| 1078 |
keep_environment=keep_environment
|
| 1079 |
)
|
|
@@ -1159,15 +1159,25 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1159 |
mask_preview = original_mask.convert("RGB")
|
| 1160 |
raw_sam_mask_display = raw_mask.convert("RGB")
|
| 1161 |
|
| 1162 |
-
|
| 1163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1164 |
|
| 1165 |
|
| 1166 |
except Exception as e:
|
| 1167 |
print(f"❌ Fehler in img_to_image: {e}")
|
| 1168 |
import traceback
|
| 1169 |
traceback.print_exc()
|
| 1170 |
-
return final_image, None, None
|
| 1171 |
|
| 1172 |
|
| 1173 |
def update_bbox_from_image(image):
|
|
@@ -1556,6 +1566,20 @@ def main_ui():
|
|
| 1556 |
height=300,
|
| 1557 |
show_download_button=False
|
| 1558 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1559 |
|
| 1560 |
#with gr.Row():
|
| 1561 |
# img_output = gr.Image(
|
|
@@ -1611,7 +1635,7 @@ def main_ui():
|
|
| 1611 |
],
|
| 1612 |
#outputs=img_output,
|
| 1613 |
#outputs=[img_output, mask_output],# NEU: Zwei Ausgaben
|
| 1614 |
-
outputs=[img_output, sam_raw_mask_output, processed_mask_output],
|
| 1615 |
concurrency_limit=1
|
| 1616 |
)
|
| 1617 |
|
|
|
|
| 1073 |
# ===== CONTROLNET: MAPS ERSTELLEN =====
|
| 1074 |
print(f"📊 ControlNet Input Größe: {scaled_image.size}")
|
| 1075 |
|
| 1076 |
+
controlnet_maps, debug_maps = controlnet_processor.prepare_controlnet_maps(
|
| 1077 |
image=scaled_image,
|
| 1078 |
keep_environment=keep_environment
|
| 1079 |
)
|
|
|
|
| 1159 |
mask_preview = original_mask.convert("RGB")
|
| 1160 |
raw_sam_mask_display = raw_mask.convert("RGB")
|
| 1161 |
|
| 1162 |
+
|
| 1163 |
+
if "pose" in debug_maps:
|
| 1164 |
+
controlnet_map1 = debug_maps["pose"]
|
| 1165 |
+
map1_label = "🎭 Pose Map"
|
| 1166 |
+
else:
|
| 1167 |
+
controlnet_map1 = debug_maps["depth"]
|
| 1168 |
+
map1_label = "🏔️ Depth Map"
|
| 1169 |
+
|
| 1170 |
+
controlnet_map2 = debug_maps["canny"]
|
| 1171 |
+
|
| 1172 |
+
# Return 5 Werte:
|
| 1173 |
+
return final_image, raw_sam_mask_display, mask_preview, controlnet_map1, controlnet_map2
|
| 1174 |
|
| 1175 |
|
| 1176 |
except Exception as e:
|
| 1177 |
print(f"❌ Fehler in img_to_image: {e}")
|
| 1178 |
import traceback
|
| 1179 |
traceback.print_exc()
|
| 1180 |
+
return final_image, None, None, None, None
|
| 1181 |
|
| 1182 |
|
| 1183 |
def update_bbox_from_image(image):
|
|
|
|
| 1566 |
height=300,
|
| 1567 |
show_download_button=False
|
| 1568 |
)
|
| 1569 |
+
|
| 1570 |
+
with gr.Row():
|
| 1571 |
+
pose_map_output = gr.Image(
|
| 1572 |
+
label="🎭 Pose/Depth Map",
|
| 1573 |
+
type="pil",
|
| 1574 |
+
height=300,
|
| 1575 |
+
show_download_button=False
|
| 1576 |
+
)
|
| 1577 |
+
canny_map_output = gr.Image(
|
| 1578 |
+
label="📐 Canny Edge Map",
|
| 1579 |
+
type="pil",
|
| 1580 |
+
height=300,
|
| 1581 |
+
show_download_button=False
|
| 1582 |
+
)
|
| 1583 |
|
| 1584 |
#with gr.Row():
|
| 1585 |
# img_output = gr.Image(
|
|
|
|
| 1635 |
],
|
| 1636 |
#outputs=img_output,
|
| 1637 |
#outputs=[img_output, mask_output],# NEU: Zwei Ausgaben
|
| 1638 |
+
outputs=[img_output, sam_raw_mask_output, processed_mask_output, pose_map_output, canny_map_output],
|
| 1639 |
concurrency_limit=1
|
| 1640 |
)
|
| 1641 |
|