Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -190,16 +190,26 @@ def update_live_preview(image, bbox_x1, bbox_y1, bbox_x2, bbox_y2, face_preserve
|
|
| 190 |
|
| 191 |
return create_preview_image(image, bbox_coords, face_preserve, mode_color)
|
| 192 |
|
|
|
|
|
|
|
|
|
|
| 193 |
def process_image_upload(image):
|
| 194 |
"""Verarbeitet Bild-Upload und gibt Bild + Koordinaten zurück"""
|
| 195 |
if image is None:
|
| 196 |
return None, None, None, None, None
|
|
|
|
|
|
|
| 197 |
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
|
| 204 |
# === HAUPTPROZESSE ===
|
| 205 |
def text_to_image(prompt, steps, guidance_scale, progress=gr.Progress()):
|
|
|
|
| 190 |
|
| 191 |
return create_preview_image(image, bbox_coords, face_preserve, mode_color)
|
| 192 |
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
|
| 196 |
def process_image_upload(image):
|
| 197 |
"""Verarbeitet Bild-Upload und gibt Bild + Koordinaten zurück"""
|
| 198 |
if image is None:
|
| 199 |
return None, None, None, None, None
|
| 200 |
+
|
| 201 |
+
width, height = image.size
|
| 202 |
|
| 203 |
+
if width > 512 or height > 512:
|
| 204 |
+
# Große Bilder: Keine bbox benötigt, nur Vorschau
|
| 205 |
+
preview = create_preview_image(image, None, True, "green") #create_preview_image Funktion erstellt nur die visuelle Vorschau
|
| 206 |
+
return preview, None, None, None, None
|
| 207 |
+
else:
|
| 208 |
+
# Kleine Bilder: bbox wie gehabt berechnen
|
| 209 |
+
bbox = auto_detect_face_area(image)
|
| 210 |
+
bbox_x1, bbox_y1, bbox_x2, bbox_y2 = bbox
|
| 211 |
+
preview = create_preview_image(image, bbox, True, "green")
|
| 212 |
+
return preview, bbox_x1, bbox_y1, bbox_x2, bbox_y2
|
| 213 |
|
| 214 |
# === HAUPTPROZESSE ===
|
| 215 |
def text_to_image(prompt, steps, guidance_scale, progress=gr.Progress()):
|