akhaliq HF staff commited on
Commit
047cb5b
1 Parent(s): ff04f46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -27,7 +27,8 @@ def generate_image(api_key, prompt, image_size='landscape_4_3', num_images=1):
27
  images.append(img)
28
  return images
29
  except Exception as e:
30
- return [Image.new('RGB', (300, 300), color='red')] # Return a red image on error
 
31
 
32
  with gr.Blocks() as demo:
33
  gr.Markdown("# FLUX1.1 [pro] Text-to-Image Generator")
@@ -43,7 +44,7 @@ with gr.Blocks() as demo:
43
  )
44
  num_images = gr.Slider(label="Number of Images", minimum=1, maximum=4, step=1, value=1)
45
  generate_btn = gr.Button("Generate Image")
46
- output_gallery = gr.Gallery(label="Generated Images").style(columns=2, rows=2, height="auto")
47
 
48
  generate_btn.click(
49
  fn=generate_image,
 
27
  images.append(img)
28
  return images
29
  except Exception as e:
30
+ print(f"Error: {e}")
31
+ return [Image.new('RGB', (300, 300), color='red') for _ in range(num_images)] # Return red images on error
32
 
33
  with gr.Blocks() as demo:
34
  gr.Markdown("# FLUX1.1 [pro] Text-to-Image Generator")
 
44
  )
45
  num_images = gr.Slider(label="Number of Images", minimum=1, maximum=4, step=1, value=1)
46
  generate_btn = gr.Button("Generate Image")
47
+ output_gallery = gr.Gallery(label="Generated Images", columns=2, rows=2)
48
 
49
  generate_btn.click(
50
  fn=generate_image,