Update README.md
Browse files
README.md
CHANGED
|
@@ -12,7 +12,7 @@ To use deploy this model a an Inference Endpoint you have to select `Custom` as
|
|
| 12 |
### expected Request payload
|
| 13 |
```json
|
| 14 |
{
|
| 15 |
-
"
|
| 16 |
}
|
| 17 |
```
|
| 18 |
below is an example on how to run a request using Python and `requests`.
|
|
@@ -32,7 +32,7 @@ HF_TOKEN = ""
|
|
| 32 |
def predict(path_to_image: str = None):
|
| 33 |
with open(path_to_image, "rb") as i:
|
| 34 |
b64 = base64.b64encode(i.read())
|
| 35 |
-
payload = {"inputs":
|
| 36 |
response = r.post(
|
| 37 |
ENDPOINT_URL, headers={"Authorization": f"Bearer {HF_TOKEN}"}, json=payload
|
| 38 |
)
|
|
@@ -43,11 +43,10 @@ prediction = predict(
|
|
| 43 |
```
|
| 44 |
expected output
|
| 45 |
```python
|
| 46 |
-
|
| 47 |
-0.5551009774208069,
|
| 48 |
0.39800673723220825,
|
| 49 |
-0.6809228658676147,
|
| 50 |
2.053842782974243,
|
| 51 |
-0.4712907075881958,...]
|
| 52 |
-
}
|
| 53 |
```
|
|
|
|
| 12 |
### expected Request payload
|
| 13 |
```json
|
| 14 |
{
|
| 15 |
+
"inputs": "/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAMCAgICAgMC....", // base64 image as bytes
|
| 16 |
}
|
| 17 |
```
|
| 18 |
below is an example on how to run a request using Python and `requests`.
|
|
|
|
| 32 |
def predict(path_to_image: str = None):
|
| 33 |
with open(path_to_image, "rb") as i:
|
| 34 |
b64 = base64.b64encode(i.read())
|
| 35 |
+
payload = {"inputs": b64.decode("utf-8")}
|
| 36 |
response = r.post(
|
| 37 |
ENDPOINT_URL, headers={"Authorization": f"Bearer {HF_TOKEN}"}, json=payload
|
| 38 |
)
|
|
|
|
| 43 |
```
|
| 44 |
expected output
|
| 45 |
```python
|
| 46 |
+
[0.016450975090265274,
|
| 47 |
-0.5551009774208069,
|
| 48 |
0.39800673723220825,
|
| 49 |
-0.6809228658676147,
|
| 50 |
2.053842782974243,
|
| 51 |
-0.4712907075881958,...]
|
|
|
|
| 52 |
```
|