
## Run Request 

The endpoint expects the image to be served as `binary`. Below is an curl and python example

#### cURL 

1. get image 

```bash
wget https://fki.tic.heia-fr.ch/static/img/a01-122-02-00.jpg -O test.jpg
```

2. send cURL request

```bash
curl --request POST \
  --url https://{ENDPOINT}/ \
  --header 'Content-Type: image/jpg' \
  --header 'Authorization: Bearer {HF_TOKEN}' \
  --data-binary '@test.jpg'
```

3. the expected output

```json
{"text": "INDLUS THE"}
```

#### Python 


1. get image 

```bash
wget https://fki.tic.heia-fr.ch/static/img/a01-122-02-00.jpg -O test.jpg
```

2. run request

```python
import json
from typing import List
import requests as r
import base64

ENDPOINT_URL=""
HF_TOKEN=""

def predict(path_to_image:str=None):
    with open(path_to_image, "rb") as i:
      b = i.read()
    headers= {
        "Authorization": f"Bearer {HF_TOKEN}",
        "Content-Type": "image/jpeg" # content type of image
    }
    response = r.post(ENDPOINT_URL, headers=headers, data=b)
    return response.json()

prediction = predict(path_to_image="test.jpg")

prediction
```

expected output

```python
{"text": "INDLUS THE"}
```
{"license": "apache-2.0", "library_name": "generic", "tags": ["trocr", "image-classification", "endpoints-template"], "pipeline_tag": "image-classification"}
generic trocr image-classification endpoints-template license:apache-2.0 region:us
TAGS
#generic #trocr #image-classification #endpoints-template #license-apache-2.0 #region-us 


## Run Request 

The endpoint expects the image to be served as 'binary'. Below is an curl and python example

#### cURL 

1. get image 



2. send cURL request



3. the expected output



#### Python 


1. get image 



2. run request



expected output


## Run Request 

The endpoint expects the image to be served as 'binary'. Below is an curl and python example #### cURL 

1. get image 



2. send cURL request



3. the expected output #### Python 


1. get image 



2. run request



expected output
TAGS
#generic #trocr #image-classification #endpoints-template #license-apache-2.0 #region-us 
 ## Run Request 

The endpoint expects the image to be served as 'binary'. Below is an curl and python example #### cURL 

1. get image 



2. send cURL request



3. the expected output #### Python 


1. get image 



2. run request



expected output