Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets
  • Docs
  • Enterprise
  • Pricing
    • Website
      • Tasks
      • HuggingChat
      • Collections
      • Languages
      • Organizations
    • Community
      • Blog
      • Posts
      • Daily Papers
      • Hardware
      • Learn
      • Discord
      • Forum
      • GitHub
    • Solutions
      • Team & Enterprise
      • Hugging Face PRO
      • Enterprise Support
      • Inference Providers
      • Inference Endpoints
      • Storage Buckets

  • Log In
  • Sign Up

philschmid
/
stable-diffusion-2-inpainting-endpoint

Image-to-Image
Diffusers
StableDiffusionInpaintPipeline
stable-diffusion
stable-diffusion-diffusers
text-guided-to-image-inpainting
endpoints-template
Model card Files Files and versions
xet
Community
3

Instructions to use philschmid/stable-diffusion-2-inpainting-endpoint with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • Diffusers

    How to use philschmid/stable-diffusion-2-inpainting-endpoint with Diffusers:

    pip install -U diffusers transformers accelerate
    import torch
    from diffusers import AutoPipelineForInpainting
    from diffusers.utils import load_image
    
    # switch to "mps" for apple devices
    pipe = AutoPipelineForInpainting.from_pretrained("philschmid/stable-diffusion-2-inpainting-endpoint", dtype=torch.float16, device_map="cuda")
    
    img_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png"
    mask_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png"
    
    image = load_image(img_url).resize((1024, 1024))
    mask_image = load_image(mask_url).resize((1024, 1024))
    
    prompt = "a tiger sitting on a park bench"
    generator = torch.Generator(device="cuda").manual_seed(0)
    
    image = pipe(
      prompt=prompt,
      image=image,
      mask_image=mask_image,
      guidance_scale=8.0,
      num_inference_steps=20,  # steps between 15 and 30 work well for us
      strength=0.99,  # make sure to use `strength` below 1.0
      generator=generator,
    ).images[0]
  • Notebooks
  • Google Colab
  • Kaggle
stable-diffusion-2-inpainting-endpoint
2.58 GB
Ctrl+K
Ctrl+K
  • 1 contributor
History: 12 commits
philschmid's picture
philschmid
Delete requirements.txt
13a0c9d about 3 years ago
  • scheduler
    add almost 4 years ago
  • text_encoder
    add almost 4 years ago
  • tokenizer
    add almost 4 years ago
  • unet
    add almost 4 years ago
  • vae
    add almost 4 years ago
  • .gitattributes
    1.48 kB
    initial commit almost 4 years ago
  • README.md
    2.9 kB
    Update README.md almost 4 years ago
  • Stable Diffusion Inference endpoints - inpainting.png
    220 kB
    Upload Stable Diffusion Inference endpoints - inpainting.png almost 4 years ago
  • create_handler.ipynb
    1.09 MB
    added custom handler almost 4 years ago
  • dog.png
    405 kB
    add almost 4 years ago
  • handler.py
    2.59 kB
    added custom handler almost 4 years ago
  • mask_dog.png
    12.1 kB
    add almost 4 years ago
  • model_index.json
    519 Bytes
    add almost 4 years ago
  • result.png
    402 kB
    added custom handler almost 4 years ago