GreenGoat commited on
Commit
2fbee37
·
verified ·
1 Parent(s): 5e6862e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -413,10 +413,17 @@ def process_relight(input_fg, input_bg, prompt, image_width, image_height, num_s
413
  error_msg = "❌ Please upload a background image or choose a lighting direction"
414
  print(error_msg)
415
  raise gr.Error(error_msg)
 
 
416
  if not prompt.strip():
417
- error_msg = " Please enter a prompt"
418
- print(error_msg)
419
- raise gr.Error(error_msg)
 
 
 
 
 
420
 
421
  print(f"Processing with device: {device}")
422
  print(f"Input shapes - FG: {input_fg.shape}, BG: {input_bg.shape if input_bg is not None else 'None'}")
 
413
  error_msg = "❌ Please upload a background image or choose a lighting direction"
414
  print(error_msg)
415
  raise gr.Error(error_msg)
416
+
417
+ # Handle empty prompt - provide default when using background image
418
  if not prompt.strip():
419
+ if bg_source == "Use Background Image" or bg_source == "Use Flipped Background Image":
420
+ # When using background image as light source, use a generic default prompt
421
+ prompt = "best quality, detailed"
422
+ print(f"Using default prompt for background lighting: {prompt}")
423
+ else:
424
+ error_msg = "❌ Please enter a prompt"
425
+ print(error_msg)
426
+ raise gr.Error(error_msg)
427
 
428
  print(f"Processing with device: {device}")
429
  print(f"Input shapes - FG: {input_fg.shape}, BG: {input_bg.shape if input_bg is not None else 'None'}")