snicolau commited on
Commit
7e0f853
Β·
verified Β·
1 Parent(s): c9943d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -100,11 +100,11 @@ def get_mask(img, num_people_keep, dilate_kernel_size):
100
  def get_inpainted_img(img, mask):
101
  lama_config = args.lama_config
102
  device = "cuda" if torch.cuda.is_available() else "cpu"
103
- out = []
104
  img_inpainted = inpaint_img_with_builded_lama(
105
  model['lama'], img, mask, lama_config, device=device)
106
- out.append(img_inpainted)
107
- return out
108
 
109
 
110
  def remove_people(img, num_people_keep, dilate_kernel_size):
@@ -137,7 +137,7 @@ with gr.Blocks() as demo:
137
 
138
  with gr.Row():
139
  with gr.Column(scale=1):
140
- img = gr.Image()# value="Input Image" .style(height="200px")
141
 
142
  num_people_keep = gr.Number(label="Number of people to keep", minimum=0, maximum=100)
143
  dilate_kernel_size = gr.Slider(label="Dilate Kernel Size", minimum=0, maximum=30, step=1, value=5)
@@ -146,7 +146,7 @@ with gr.Blocks() as demo:
146
  clear_button_image = gr.Button(value="Reset", variant="secondary", size="sm")#.style(full_width=True, size="sm")
147
 
148
  with gr.Column(scale=1):
149
- img_out = gr.Image(interactive=False,show_download_button=True)# value="Image with People Removed", type="numpy", .style(height="200px")
150
 
151
  #mask = gr.outputs.Image(type="numpy", label="Segmentation Mask")#.style(height="200px")
152
 
 
100
  def get_inpainted_img(img, mask):
101
  lama_config = args.lama_config
102
  device = "cuda" if torch.cuda.is_available() else "cpu"
103
+
104
  img_inpainted = inpaint_img_with_builded_lama(
105
  model['lama'], img, mask, lama_config, device=device)
106
+
107
+ return img_inpainted
108
 
109
 
110
  def remove_people(img, num_people_keep, dilate_kernel_size):
 
137
 
138
  with gr.Row():
139
  with gr.Column(scale=1):
140
+ img = gr.Image(height=500)# value="Input Image" .style(height="200px")
141
 
142
  num_people_keep = gr.Number(label="Number of people to keep", minimum=0, maximum=100)
143
  dilate_kernel_size = gr.Slider(label="Dilate Kernel Size", minimum=0, maximum=30, step=1, value=5)
 
146
  clear_button_image = gr.Button(value="Reset", variant="secondary", size="sm")#.style(full_width=True, size="sm")
147
 
148
  with gr.Column(scale=1):
149
+ img_out = gr.Image(height=500, interactive=False,show_download_button=True)# value="Image with People Removed", type="numpy", .style(height="200px")
150
 
151
  #mask = gr.outputs.Image(type="numpy", label="Segmentation Mask")#.style(height="200px")
152