philschmid / stable-diffusion-2-inpainting-endpoint

huggingface.co
Total runs: 61
24-hour runs: 1
7-day runs: 24
30-day runs: 40
Model's Last Updated: September 29 2023
image-to-image

Introduction of stable-diffusion-2-inpainting-endpoint

Model Details of stable-diffusion-2-inpainting-endpoint

Fork of stabilityai/stable-diffusion-2-inpainting

Stable Diffusion is a latent text-to-image diffusion model capable of generating photo-realistic images given any text input. For more information about how Stable Diffusion functions, please have a look at 🤗's Stable Diffusion with 🧨Diffusers blog .

For more information about the model, license and limitations check the original model card at stabilityai/stable-diffusion-2-inpainting .


This repository implements a custom handler task for text-guided-to-image-inpainting for 🤗 Inference Endpoints. The code for the customized pipeline is in the handler.py .

There is also a notebook included, on how to create the handler.py

thubmnail

expected Request payload
{
    "inputs": "A prompt used for image generation",
    "image" : "iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAIAAAB7GkOtAAAABGdBTUEAALGPC",
    "mask_image": "iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAIAAAB7GkOtAAAABGdBTUEAALGPC",
}

below is an example on how to run a request using Python and requests .

Run Request
import json
from typing import List
import requests as r
import base64
from PIL import Image
from io import BytesIO

ENDPOINT_URL = ""
HF_TOKEN = ""

# helper image utils
def encode_image(image_path):
  with open(image_path, "rb") as i:
    b64 = base64.b64encode(i.read())
  return b64.decode("utf-8")


def predict(prompt, image, mask_image):
    image = encode_image(image)
    mask_image = encode_image(mask_image)

    # prepare sample payload
    request = {"inputs": prompt, "image": image, "mask_image": mask_image}
    # headers
    headers = {
        "Authorization": f"Bearer {HF_TOKEN}",
        "Content-Type": "application/json",
        "Accept": "image/png" # important to get an image back
    }

    response = r.post(ENDPOINT_URL, headers=headers, json=payload)
    img = Image.open(BytesIO(response.content))
    return img

prediction = predict(
    prompt="Face of a bengal cat, high resolution, sitting on a park bench",
    image="dog.png",
    mask_image="mask_dog.png"
)

expected output

sample

Runs of philschmid stable-diffusion-2-inpainting-endpoint on huggingface.co

61
Total runs
1
24-hour runs
-5
3-day runs
24
7-day runs
40
30-day runs

More Information About stable-diffusion-2-inpainting-endpoint huggingface.co Model

More stable-diffusion-2-inpainting-endpoint license Visit here:

https://choosealicense.com/licenses/openrail++

stable-diffusion-2-inpainting-endpoint huggingface.co

stable-diffusion-2-inpainting-endpoint huggingface.co is an AI model on huggingface.co that provides stable-diffusion-2-inpainting-endpoint's model effect (), which can be used instantly with this philschmid stable-diffusion-2-inpainting-endpoint model. huggingface.co supports a free trial of the stable-diffusion-2-inpainting-endpoint model, and also provides paid use of the stable-diffusion-2-inpainting-endpoint. Support call stable-diffusion-2-inpainting-endpoint model through api, including Node.js, Python, http.

stable-diffusion-2-inpainting-endpoint huggingface.co Url

https://huggingface.co/philschmid/stable-diffusion-2-inpainting-endpoint

philschmid stable-diffusion-2-inpainting-endpoint online free

stable-diffusion-2-inpainting-endpoint huggingface.co is an online trial and call api platform, which integrates stable-diffusion-2-inpainting-endpoint's modeling effects, including api services, and provides a free online trial of stable-diffusion-2-inpainting-endpoint, you can try stable-diffusion-2-inpainting-endpoint online for free by clicking the link below.

philschmid stable-diffusion-2-inpainting-endpoint online free url in huggingface.co:

https://huggingface.co/philschmid/stable-diffusion-2-inpainting-endpoint

stable-diffusion-2-inpainting-endpoint install

stable-diffusion-2-inpainting-endpoint is an open source model from GitHub that offers a free installation service, and any user can find stable-diffusion-2-inpainting-endpoint on GitHub to install. At the same time, huggingface.co provides the effect of stable-diffusion-2-inpainting-endpoint install, users can directly use stable-diffusion-2-inpainting-endpoint installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

stable-diffusion-2-inpainting-endpoint install url in huggingface.co:

https://huggingface.co/philschmid/stable-diffusion-2-inpainting-endpoint

Url of stable-diffusion-2-inpainting-endpoint

stable-diffusion-2-inpainting-endpoint huggingface.co Url

Provider of stable-diffusion-2-inpainting-endpoint huggingface.co

philschmid
ORGANIZATIONS

Other API from philschmid