Update README.md
Browse files
README.md
CHANGED
|
@@ -33,4 +33,25 @@ Midjourney is most realistic and powerful ai image generator in the world. Here
|
|
| 33 |
|
| 34 |
## Examples
|
| 35 |
|
| 36 |
-
<Gallery />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
## Examples
|
| 35 |
|
| 36 |
+
<Gallery />
|
| 37 |
+
|
| 38 |
+
## Usage
|
| 39 |
+
|
| 40 |
+
You can use this model using huggingface Interface API:
|
| 41 |
+
```Python
|
| 42 |
+
import requests
|
| 43 |
+
|
| 44 |
+
API_URL = "https://api-inference.huggingface.co/models/Kvikontent/midjourney-v6"
|
| 45 |
+
headers = {"Authorization": "Bearer HUGGINGFACE_API_TOKEN"}
|
| 46 |
+
|
| 47 |
+
def query(payload):
|
| 48 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
| 49 |
+
return response.content
|
| 50 |
+
image_bytes = query({
|
| 51 |
+
"inputs": "Astronaut riding a horse",
|
| 52 |
+
})
|
| 53 |
+
# You can access the image with PIL.Image for example
|
| 54 |
+
import io
|
| 55 |
+
from PIL import Image
|
| 56 |
+
image = Image.open(io.BytesIO(image_bytes))
|
| 57 |
+
```
|