Zeroxdesignart
commited on
Commit
•
89cad2e
1
Parent(s):
13c742f
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
|
3 |
+
API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0"
|
4 |
+
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
5 |
+
|
6 |
+
def query(payload):
|
7 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
8 |
+
return response.content
|
9 |
+
image_bytes = query({
|
10 |
+
"inputs": "Astronaut riding a horse",
|
11 |
+
})
|
12 |
+
# You can access the image with PIL.Image for example
|
13 |
+
import io
|
14 |
+
from PIL import Image
|
15 |
+
image = Image.open(io.BytesIO(image_bytes))
|