sayakpaul HF staff commited on
Commit
4140515
1 Parent(s): 3e88afc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +36 -1
README.md CHANGED
@@ -8,6 +8,9 @@ tags:
8
  inference: false
9
  ---
10
 
 
 
 
11
  ```py
12
  from handler import EndpointHandler
13
 
@@ -19,4 +22,36 @@ image = my_handler(payload)
19
  image.save("image.png")
20
  ```
21
 
22
- ![](./image.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  inference: false
9
  ---
10
 
11
+ > [!IMPORTANT]
12
+ > This repo duplicates the [Stable Diffusion 3.5 Large](https://huggingface.co/stabilityai/stable-diffusion-3.5-large) weights for demonstration purposes and it doesn't own any credits to the model. So, please be mindful of that and respect the original license of the model.
13
+
14
  ```py
15
  from handler import EndpointHandler
16
 
 
22
  image.save("image.png")
23
  ```
24
 
25
+ ![](./image.png)
26
+
27
+ We can use this repo to deploy SD3.5 Large on [Inference Endpoints](https://huggingface.co/docs/inference-endpoints) as well.
28
+
29
+ ```py
30
+ import json
31
+ import requests
32
+ import base64
33
+ from PIL import Image
34
+ from io import BytesIO
35
+
36
+ ENDPOINT_URL = ""
37
+ HF_TOKEN = ""
38
+
39
+
40
+ def decode_base64_image(image_string):
41
+ base64_image = base64.b64decode(image_string)
42
+ buffer = BytesIO(base64_image)
43
+ return Image.open(buffer).save("image.png")
44
+
45
+
46
+ def predict(prompt: str = "a dog waiting for its companion to come."):
47
+ payload = {"inputs": {"prompt": prompt}}
48
+ response = requests.post(ENDPOINT_URL, headers={"Authorization": f"Bearer {HF_TOKEN}"}, json=payload)
49
+ resp = response.json()
50
+ return decode_base64_image(resp)
51
+
52
+
53
+ prediction = predict(prompt="the first animal on the mars")
54
+ ```
55
+
56
+ This is how the final image would look like:
57
+