File size: 433 Bytes
38f925c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
import spaces
import torch
from PIL import Image
from simple_lama_inpainting import SimpleLama
lama: SimpleLama = SimpleLama()

zero = torch.Tensor([0]).cuda()
print(zero.device) # <-- 'cpu' 🤔

@spaces.GPU
def lama_inpainting(image: Image, mask: Image) -> Image:
    return lama(image, mask)

inpaint = gr.Interface(fn=lama_inpainting, inputs=[gr.Image(), gr.ImageMask()], outputs=gr.Image())
inpaint.launch()