Views
No views yet
1import requests
2
3API_URL = "https://api-inference.huggingface.co/models/Kvikontent/midjourney-v6"
4headers = {"Authorization": "Bearer HUGGINGFACE_API_TOKEN"}
5
6def query(payload):
7 response = requests.post(API_URL, headers=headers, json=payload)
8 return response.content
9image_bytes = query({
10 "inputs": "Astronaut riding a horse",
11})
12# You can access the image with PIL.Image for example
13import io
14from PIL import Image
15image = Image.open(io.BytesIO(image_bytes))