florentgbelidji HF staff commited on
Commit
eec2f88
1 Parent(s): 8a132f7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -3
README.md CHANGED
@@ -23,7 +23,8 @@ below is an example on how to run a request using Python and `requests`.
23
  ```bash
24
  !wget https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg
25
  ```
26
- 2. run request
 
27
  ```python
28
  import json
29
  from typing import List
@@ -36,7 +37,7 @@ HF_TOKEN = ""
36
  def predict(path_to_image: str = None):
37
  with open(path_to_image, "rb") as i:
38
  b64 = base64.b64encode(i.read())
39
- payload = {"inputs": {"image": b64.decode("utf-8"), "candiates": candiates}}
40
  response = r.post(
41
  ENDPOINT_URL, headers={"Authorization": f"Bearer {HF_TOKEN}"}, json=payload
42
  )
@@ -44,9 +45,9 @@ def predict(path_to_image: str = None):
44
  prediction = predict(
45
  path_to_image="palace.jpg"
46
  )
 
47
  ```
48
  expected output
49
  ```python
50
  ['buckingham palace with flower beds and red flowers']
51
-
52
  ```
 
23
  ```bash
24
  !wget https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg
25
  ```
26
+ 2.run request
27
+
28
  ```python
29
  import json
30
  from typing import List
 
37
  def predict(path_to_image: str = None):
38
  with open(path_to_image, "rb") as i:
39
  b64 = base64.b64encode(i.read())
40
+ payload = {"inputs": {"image": b64.decode("utf-8")}}
41
  response = r.post(
42
  ENDPOINT_URL, headers={"Authorization": f"Bearer {HF_TOKEN}"}, json=payload
43
  )
 
45
  prediction = predict(
46
  path_to_image="palace.jpg"
47
  )
48
+
49
  ```
50
  expected output
51
  ```python
52
  ['buckingham palace with flower beds and red flowers']
 
53
  ```