Code View
Browse files## View Via Code
README.md
CHANGED
|
@@ -25,3 +25,22 @@ Try it now!
|
|
| 25 |
Weights for this model are available in Safetensors format.
|
| 26 |
|
| 27 |
[Download](/GamerC0der/MiniDiffusion1/tree/main) them in the Files & versions tab.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
Weights for this model are available in Safetensors format.
|
| 26 |
|
| 27 |
[Download](/GamerC0der/MiniDiffusion1/tree/main) them in the Files & versions tab.
|
| 28 |
+
|
| 29 |
+
## Use Via Code!!!
|
| 30 |
+
```python
|
| 31 |
+
import requests
|
| 32 |
+
|
| 33 |
+
API_URL = "https://api-inference.huggingface.co/models/GamerC0der/MiniDiffusion1"
|
| 34 |
+
headers = {"Authorization": "Bearer INSERTKEYHERE"}
|
| 35 |
+
|
| 36 |
+
def query(payload):
|
| 37 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
| 38 |
+
return response.content
|
| 39 |
+
image_bytes = query({
|
| 40 |
+
"inputs": prompthere,
|
| 41 |
+
})
|
| 42 |
+
# You can access the image with PIL.Image for example
|
| 43 |
+
import io
|
| 44 |
+
from PIL import Image
|
| 45 |
+
image = Image.open(io.BytesIO(image_bytes))
|
| 46 |
+
```
|