blanchon commited on
Commit
55c3f2f
·
1 Parent(s): 98a3570

Revert back gr.Image in gallery

Browse files
Files changed (1) hide show
  1. app.py +4 -11
app.py CHANGED
@@ -8,6 +8,7 @@ import numpy as np
8
  import spaces
9
  import torch
10
  from diffusers import FluxFillPipeline
 
11
  from gradio.components.image_editor import EditorValue
12
  from PIL import Image, ImageFilter, ImageOps
13
 
@@ -28,7 +29,7 @@ if not torch.cuda.is_available():
28
  def _dummy_pipe(image: Image.Image, *args, **kwargs): # noqa: ARG001
29
  # return {"images": [image]} # noqa: ERA001
30
  blue_image = Image.new("RGB", image.size, (0, 0, 255))
31
- return {"images": [blue_image]}
32
 
33
  pipe = _dummy_pipe
34
  else:
@@ -185,7 +186,7 @@ def infer(
185
  max_dimension: int = 720,
186
  num_images_per_prompt: int = 2,
187
  progress: gr.Progress = gr.Progress(track_tqdm=True), # noqa: ARG001, B008
188
- ):
189
  # Ensure max_dimension is a multiple of 16 (for VAE)
190
  max_dimension = (max_dimension // 16) * 16
191
 
@@ -317,15 +318,6 @@ def infer(
317
  room_mask_cropped,
318
  )
319
  final_images.append(final_image)
320
- final_images_gradio = [
321
- gr.Image(
322
- value=image,
323
- label=f"Result {i + 1}",
324
- show_label=False,
325
- interactive=False,
326
- )
327
- for i, image in enumerate(final_images)
328
- ]
329
 
330
  return final_images, seed
331
 
@@ -447,6 +439,7 @@ with gr.Blocks(css=css) as demo:
447
  show_label=False,
448
  columns=2,
449
  height=500,
 
450
  )
451
  run_button = gr.Button("Run")
452
 
 
8
  import spaces
9
  import torch
10
  from diffusers import FluxFillPipeline
11
+ from gradio.components.gallery import GalleryMediaType
12
  from gradio.components.image_editor import EditorValue
13
  from PIL import Image, ImageFilter, ImageOps
14
 
 
29
  def _dummy_pipe(image: Image.Image, *args, **kwargs): # noqa: ARG001
30
  # return {"images": [image]} # noqa: ERA001
31
  blue_image = Image.new("RGB", image.size, (0, 0, 255))
32
+ return {"images": [blue_image, blue_image, blue_image]}
33
 
34
  pipe = _dummy_pipe
35
  else:
 
186
  max_dimension: int = 720,
187
  num_images_per_prompt: int = 2,
188
  progress: gr.Progress = gr.Progress(track_tqdm=True), # noqa: ARG001, B008
189
+ ) -> tuple[GalleryMediaType, int]:
190
  # Ensure max_dimension is a multiple of 16 (for VAE)
191
  max_dimension = (max_dimension // 16) * 16
192
 
 
318
  room_mask_cropped,
319
  )
320
  final_images.append(final_image)
 
 
 
 
 
 
 
 
 
321
 
322
  return final_images, seed
323
 
 
439
  show_label=False,
440
  columns=2,
441
  height=500,
442
+ interactive=False,
443
  )
444
  run_button = gr.Button("Run")
445