Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -722,11 +722,20 @@ def main_ui():
|
|
| 722 |
img_input.change(
|
| 723 |
fn=process_image_upload,
|
| 724 |
inputs=[img_input],
|
| 725 |
-
outputs=[preview_output, bbox_x1, bbox_y1, bbox_x2, bbox_y2]
|
|
|
|
| 726 |
)
|
| 727 |
|
| 728 |
# LÖSUNG 2: Live-Updates mit DEBOUNCING bei Koordinaten-Änderungen
|
| 729 |
coordinate_inputs = [img_input, bbox_x1, bbox_y1, bbox_x2, bbox_y2, face_preserve]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 730 |
|
| 731 |
# Jeder Koordinaten-Schieberegler mit Debouncing
|
| 732 |
bbox_x1.change(
|
|
|
|
| 722 |
img_input.change(
|
| 723 |
fn=process_image_upload,
|
| 724 |
inputs=[img_input],
|
| 725 |
+
outputs=[preview_output, bbox_x1, bbox_y1, bbox_x2, bbox_y2],
|
| 726 |
+
queue=False # WICHTIG: Keine Queue für initialen Upload
|
| 727 |
)
|
| 728 |
|
| 729 |
# LÖSUNG 2: Live-Updates mit DEBOUNCING bei Koordinaten-Änderungen
|
| 730 |
coordinate_inputs = [img_input, bbox_x1, bbox_y1, bbox_x2, bbox_y2, face_preserve]
|
| 731 |
+
|
| 732 |
+
# Jeder Koordinaten-Schieberegler mit Debouncing - NUR wenn Bild vorhanden
|
| 733 |
+
def safe_update_live_preview(image, bbox_x1, bbox_y1, bbox_x2, bbox_y2, face_preserve):
|
| 734 |
+
"""Aktualisiert die Vorschau nur wenn ein Bild vorhanden ist"""
|
| 735 |
+
if image is None:
|
| 736 |
+
return None
|
| 737 |
+
return update_live_preview(image, bbox_x1, bbox_y1, bbox_x2, bbox_y2, face_preserve)
|
| 738 |
+
|
| 739 |
|
| 740 |
# Jeder Koordinaten-Schieberegler mit Debouncing
|
| 741 |
bbox_x1.change(
|