This repo duplicates the Stable Diffusion 3.5 Large weights for demonstration purposes and it doesn't own any credits to the model. So, please be mindful of that and respect the original license of the model.
from handler import EndpointHandler
my_handler = EndpointHandler()
payload = {"inputs": {"prompt": "a dog waiting for its companion to come."}}
# test the handler
image = my_handler(payload)
image.save("image.png")
We can use this repo to deploy SD3.5 Large on Inference Endpoints as well.
import json
import requests
import base64
from PIL import Image
from io import BytesIO
ENDPOINT_URL = ""
HF_TOKEN = ""
def decode_base64_image(image_string):
base64_image = base64.b64decode(image_string)
buffer = BytesIO(base64_image)
return Image.open(buffer).save("image.png")
def predict(prompt: str = "a dog waiting for its companion to come."):
payload = {"inputs": {"prompt": prompt}}
response = requests.post(ENDPOINT_URL, headers={"Authorization": f"Bearer {HF_TOKEN}"}, json=payload)
resp = response.json()
return decode_base64_image(resp)
prediction = predict(prompt="the first animal on the mars")
This is how the final image would look like:
- Downloads last month
- 56