Update README.md
Browse files
README.md
CHANGED
@@ -26,6 +26,32 @@ prompt: a photo of a {profession}, looking at the camera, closeup headshot facin
|
|
26 |
|
27 |
# How to use this model:
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
``` python
|
30 |
|
31 |
|
|
|
26 |
|
27 |
# How to use this model:
|
28 |
|
29 |
+
|
30 |
+
``` API
|
31 |
+
|
32 |
+
import requests
|
33 |
+
|
34 |
+
API_URL = "https://api-inference.huggingface.co/models/NYUAD-ComNets/Middle_Eastern_Male_Profession_Model"
|
35 |
+
headers = {"Authorization": "Bearer {hugging_face token}"}
|
36 |
+
|
37 |
+
def query(payload):
|
38 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
39 |
+
return response.content
|
40 |
+
|
41 |
+
image_bytes = query({
|
42 |
+
"inputs": "a headshot of a person with green hair and eyeglasses",
|
43 |
+
"parameters": {"negative_prompt": "cartoon",
|
44 |
+
"seed":766},
|
45 |
+
})
|
46 |
+
# You can access the image with PIL.Image for example
|
47 |
+
import io
|
48 |
+
from PIL import Image
|
49 |
+
image = Image.open(io.BytesIO(image_bytes))
|
50 |
+
image
|
51 |
+
|
52 |
+
```
|
53 |
+
|
54 |
+
|
55 |
``` python
|
56 |
|
57 |
|