Astridkraft commited on
Commit
a9e4578
Β·
verified Β·
1 Parent(s): b202444

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -922,7 +922,7 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
922
  """
923
  try:
924
  if image is None:
925
- return None
926
 
927
  import time, random
928
  start_time = time.time()
@@ -933,6 +933,8 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
933
  print(f"πŸ“Š Einstellungen: Strength: {strength}, Steps: {steps}, Guidance: {guidance_scale}")
934
  print(f"πŸ“ Prompt: {prompt}")
935
  print(f"🚫 Negativ-Prompt: {neg_prompt}")
 
 
936
 
937
  # ===== AUTOMATISCHEN NEGATIV-PROMPT GENERIEREN =====
938
  auto_negatives = auto_negative_prompt(prompt)
@@ -1313,6 +1315,13 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
1313
  print(f"❌ Fehler in img_to_image: {e}")
1314
  import traceback
1315
  traceback.print_exc()
 
 
 
 
 
 
 
1316
  return final_image, None, None, None, None
1317
 
1318
 
 
922
  """
923
  try:
924
  if image is None:
925
+ return None, None, None, None, None
926
 
927
  import time, random
928
  start_time = time.time()
 
933
  print(f"πŸ“Š Einstellungen: Strength: {strength}, Steps: {steps}, Guidance: {guidance_scale}")
934
  print(f"πŸ“ Prompt: {prompt}")
935
  print(f"🚫 Negativ-Prompt: {neg_prompt}")
936
+
937
+ final_image = None # Variable wird initiiert!
938
 
939
  # ===== AUTOMATISCHEN NEGATIV-PROMPT GENERIEREN =====
940
  auto_negatives = auto_negative_prompt(prompt)
 
1315
  print(f"❌ Fehler in img_to_image: {e}")
1316
  import traceback
1317
  traceback.print_exc()
1318
+
1319
+ # Fallback: Return das Originalbild oder ein leeres Bild
1320
+ if image is not None:
1321
+ fallback_image = image.copy()
1322
+ else:
1323
+ fallback_image = Image.new("RGB", (512, 512), color="gray")
1324
+
1325
  return final_image, None, None, None, None
1326
 
1327