Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
tags:
|
3 |
- text-to-image
|
|
|
1 |
+
---
|
2 |
+
widget:
|
3 |
+
- text: ksrksr a man is standing facing forward
|
4 |
+
output:
|
5 |
+
url: images/ksrksr_e000033_00_20241012044531.png
|
6 |
+
base_model: enhanceaiteam/FLUX.1-Pro
|
7 |
+
instance_prompt: ksrksr
|
8 |
+
license: mit
|
9 |
+
pipeline_tag: text-to-image
|
10 |
+
---
|
11 |
+
import requests
|
12 |
+
|
13 |
+
API_URL = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev"
|
14 |
+
headers = {"Authorization": "Bearer hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
|
15 |
+
|
16 |
+
def query(payload):
|
17 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
18 |
+
return response.content
|
19 |
+
image_bytes = query({
|
20 |
+
"inputs": "Astronaut riding a horse",
|
21 |
+
})
|
22 |
+
# You can access the image with PIL.Image for example
|
23 |
+
import io
|
24 |
+
from PIL import Image
|
25 |
+
image = Image.open(io.BytesIO(image_bytes))
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
---
|
30 |
tags:
|
31 |
- text-to-image
|