Downloads · 30 days
2
10% of all-time downloads
QUBUHUB/stable-diffusion-v1-4-endpoints
stable-diffusion-v1-4-endpoints is a text-to-image model from QUBUHUB. Use it when you need an image from a text prompt. It is set up for diffusers. The card lists the license as creativeml-openrail-m.
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 Stabl…
Downloads · 30 days
2
10% of all-time downloads
All-time downloads
21
Public
Repo size
2.7 GB
Likes
0
Public
Click a slice to open those files.
.bin2.7 GB · 100%
From the Hugging Face model README
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 CompVis/stable-diffusion-v1-4.
The full license can be found here: https://huggingface.co/spaces/CompVis/stable-diffusion-license
This repository implements a custom handler task for text-to-image for 🤗 Inference Endpoints. The code for the customized pipeline is in the pipeline.py.
There is also a notebook included, on how to create the handler.py
{
"inputs": "A prompt used for image generation"
}
below is an example on how to run a request using Python and requests.
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 decoder
def decode_base64_image(image_string):
base64_image = base64.b64decode(image_string)
buffer = BytesIO(base64_image)
return Image.open(buffer)
def predict(prompt:str=None):
payload = {"inputs": code_snippet,"parameters": parameters}
response = r.post(
ENDPOINT_URL, headers={"Authorization": f"Bearer {HF_TOKEN}"}, json={"inputs": prompt}
)
resp = response.json()
return decode_base64_image(resp["image"])
prediction = predict(
prompt="the first animal on the mars"
)
expected output
