Fabrice-TIERCELIN commited on
Commit
36ff3ea
1 Parent(s): a38558b
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -5,6 +5,7 @@ import math
5
  import random
6
  import imageio
7
  import torch
 
8
 
9
  from diffusers import StableDiffusionXLInpaintPipeline
10
  from PIL import Image, ImageFilter
@@ -52,6 +53,7 @@ def check(
52
  if prompt is None or prompt == "":
53
  raise gr.Error("Please provide a prompt input.")
54
 
 
55
  def inpaint(
56
  source_img,
57
  prompt,
@@ -204,7 +206,8 @@ with gr.Blocks() as interface:
204
  <li>To modify <b>anything else</b> on your image, I recommend to use <i>Instruct Pix2Pix</i>.</li>
205
  </ul>
206
  <br/>
207
- 🐌 Slow process... ~1 hour. Your computer must not enter into standby mode.<br/>You can duplicate this space on a free account, it works on CPU and should also run on CUDA.<br/>
 
208
  <a href='https://huggingface.co/spaces/Fabrice-TIERCELIN/Inpaint?duplicate=true'><img src='https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14'></a>
209
  <br/>
210
  ⚖️ You can use, modify and share the generated images but not for commercial uses.
 
5
  import random
6
  import imageio
7
  import torch
8
+ import spaces
9
 
10
  from diffusers import StableDiffusionXLInpaintPipeline
11
  from PIL import Image, ImageFilter
 
53
  if prompt is None or prompt == "":
54
  raise gr.Error("Please provide a prompt input.")
55
 
56
+ @spaces.GPU(duration=420)
57
  def inpaint(
58
  source_img,
59
  prompt,
 
206
  <li>To modify <b>anything else</b> on your image, I recommend to use <i>Instruct Pix2Pix</i>.</li>
207
  </ul>
208
  <br/>
209
+ """ + ("🏃‍♀️ Estimated time: few minutes." if torch.cuda.is_available() else "🐌 Slow process... ~1 hour.") + """
210
+ Your computer must not enter into standby mode.<br/>You can duplicate this space on a free account, it's designed to work on CPU, GPU and ZeroGPU.<br/>
211
  <a href='https://huggingface.co/spaces/Fabrice-TIERCELIN/Inpaint?duplicate=true'><img src='https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14'></a>
212
  <br/>
213
  ⚖️ You can use, modify and share the generated images but not for commercial uses.