Fabrice-TIERCELIN commited on
Commit
9fdefc9
1 Parent(s): f5a76ac

Opacity 50%

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -152,7 +152,8 @@ def inpaint(
152
  process_width = process_width - (process_width % 8)
153
  process_height = process_height - (process_height % 8)
154
 
155
- progress(None, desc = "Processing...")
 
156
  output_image = inpaint_on_gpu(
157
  seed,
158
  process_width,
@@ -165,7 +166,8 @@ def inpaint(
165
  guidance_scale,
166
  image_guidance_scale,
167
  strength,
168
- denoising_steps
 
169
  )
170
 
171
  if limitation != "":
@@ -200,7 +202,8 @@ def inpaint_on_gpu2(
200
  guidance_scale,
201
  image_guidance_scale,
202
  strength,
203
- denoising_steps
 
204
  ):
205
  return input_image
206
 
@@ -217,8 +220,10 @@ def inpaint_on_gpu(
217
  guidance_scale,
218
  image_guidance_scale,
219
  strength,
220
- denoising_steps
 
221
  ):
 
222
  return pipe(
223
  seeds = [seed],
224
  width = process_width,
@@ -238,7 +243,7 @@ def inpaint_on_gpu(
238
  with gr.Blocks() as interface:
239
  gr.HTML(
240
  """
241
- <h1 style="text-align: center;">Inpaint</h1>
242
  <p style="text-align: center;">Modifies one detail of your image, at any resolution, freely, without account, without watermark, without installation, which can be downloaded</p>
243
  <br/>
244
  <br/>
@@ -263,7 +268,7 @@ with gr.Blocks() as interface:
263
  """
264
  )
265
  with gr.Column():
266
- source_img = gr.ImageMask(label = "Your image (click on the landscape 🌄 to upload your image; click on the pen 🖌️ to draw the mask)", type = "pil", brush=gr.Brush(colors=["white"], color_mode="fixed"))
267
  prompt = gr.Textbox(label = "Prompt", info = "Describe the subject, the background and the style of image; 77 token limit", placeholder = "Describe what you want to see in the entire image", lines = 2)
268
  with gr.Accordion("Upload a mask", open = False):
269
  uploaded_mask = gr.Image(label = "Already made mask (black pixels will be preserved, white pixels will be redrawn)", sources = ["upload"], type = "pil")
 
152
  process_width = process_width - (process_width % 8)
153
  process_height = process_height - (process_height % 8)
154
 
155
+ if torch.cuda.is_available():
156
+ progress(None, desc = "Searching a GPU...")
157
  output_image = inpaint_on_gpu(
158
  seed,
159
  process_width,
 
166
  guidance_scale,
167
  image_guidance_scale,
168
  strength,
169
+ denoising_steps,
170
+ progress
171
  )
172
 
173
  if limitation != "":
 
202
  guidance_scale,
203
  image_guidance_scale,
204
  strength,
205
+ denoising_steps,
206
+ progress
207
  ):
208
  return input_image
209
 
 
220
  guidance_scale,
221
  image_guidance_scale,
222
  strength,
223
+ denoising_steps,
224
+ progress
225
  ):
226
+ progress(None, desc = "Processing...")
227
  return pipe(
228
  seeds = [seed],
229
  width = process_width,
 
243
  with gr.Blocks() as interface:
244
  gr.HTML(
245
  """
246
+ <h1 style="text-align: center;">Inpaint / Outpaint</h1>
247
  <p style="text-align: center;">Modifies one detail of your image, at any resolution, freely, without account, without watermark, without installation, which can be downloaded</p>
248
  <br/>
249
  <br/>
 
268
  """
269
  )
270
  with gr.Column():
271
+ source_img = gr.ImageMask(label = "Your image (click on the landscape 🌄 to upload your image; click on the pen 🖌️ to draw the mask)", type = "pil", brush=gr.Brush(colors=["#FFFFFF80"], color_mode="fixed"))
272
  prompt = gr.Textbox(label = "Prompt", info = "Describe the subject, the background and the style of image; 77 token limit", placeholder = "Describe what you want to see in the entire image", lines = 2)
273
  with gr.Accordion("Upload a mask", open = False):
274
  uploaded_mask = gr.Image(label = "Already made mask (black pixels will be preserved, white pixels will be redrawn)", sources = ["upload"], type = "pil")