import requests | |
API_URL = "https://api-inference.huggingface.co/models/mhdang/dpo-sdxl-text2image-v1" | |
def query(payload): | |
response = requests.post(API_URL, headers=headers, json=payload) | |
return response.content | |
image_bytes = query({ | |
"inputs": "A stunning young blonde supermodel wearing a tight red silk dress that emphasizes her ample bosom", | |
}) | |
# You can access the image with PIL.Image for example | |
import io | |
from PIL import Image | |
image = Image.open(io.BytesIO(image_bytes)) |