Warlord-K's picture
Update app.py
a09cb5a
raw
history blame contribute delete
528 Bytes
from diffusers import StableDiffusionInpaintPipeline
import gradio as gr
import torch
pipe = StableDiffusionInpaintPipeline.from_pretrained(
"runwayml/stable-diffusion-inpainting",
revision="fp16",
torch_dtype=torch.float16,
)
def inpaint(prompt, image, mask_image):
image = pipe(prompt=prompt, image=image, mask_image=mask_image).images[0]
return image
demo = gr.Interface(inpaint, ["text", gr.Image(type="pil"), gr.Image(type="pil")], gr.Image(type="pil"))
if __name__ == "__main__":
demo.launch()