# Image Captioner API

### About

With advanced machine learning algorithms at its core, this API seamlessly analyzes visual content and generates concise and natural language captions to enhance understanding and accessibility.

Whether you're managing a vast image library, developing applications for the visually impaired, or seeking to enrich user experiences, our Image Captioner API offers unparalleled versatility and reliability. By leveraging state-of-the-art deep learning techniques, it can identify objects, scenes, activities, and more within images, crafting descriptive captions that capture the essence of each visual moment.

Our API prioritizes both accuracy and fluency, ensuring that generated captions not only reflect the content of the image but also resonate with human-like comprehension. From everyday scenes to complex compositions, it excels in capturing the nuances and details that define each image, enabling seamless integration into various applications across industries.

Experience the power of AI-driven image understanding with our Image Captioner API, and unlock new possibilities for enriching content, improving accessibility, and enhancing user engagement.

#### Developer Portal:  <https://api.market/store/magicapi/captioner>

![image](https://telegra.ph/file/e4a72c3fc980534f4eb45.png)

### Curl Requests and Responses

**Process the API**

{% tabs %}
{% tab title="Curl" %}

```bash
curl -X 'POST' \
  'https://prod.api.market/api/v1/magicapi/captioner/captioner' \
  -H 'accept: application/json' \
  -H 'x-api-market-key: API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "image": "https://telegra.ph/file/e4a72c3fc980534f4eb45.png",
  "task": "image_captioning"
}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

headers = {
    'accept': 'application/json',
    'x-api-market-key': 'API_KEY',
    'Content-Type': 'application/json',
}

json_data = {
    'image': 'https://telegra.ph/file/e4a72c3fc980534f4eb45.png',
    'task': 'image_captioning',
}

response = requests.post('https://prod.api.market/api/v1/magicapi/captioner/captioner', headers=headers, json=json_data)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://prod.api.market/api/v1/magicapi/captioner/captioner');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'accept: application/json',
    'x-api-market-key: API_KEY',
    'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n  \"image\": \"https://telegra.ph/file/e4a72c3fc980534f4eb45.png\",\n  \"task\": \"image_captioning\"\n}");

$response = curl_exec($ch);

curl_close($ch);
```

{% endtab %}

{% tab title="NodeJs" %}

```javascript
import axios from 'axios';

const response = await axios.post(
  'https://prod.api.market/api/v1/magicapi/captioner/captioner',
  {
    'image': 'https://telegra.ph/file/e4a72c3fc980534f4eb45.png',
    'task': 'image_captioning'
  },
  {
    headers: {
      'accept': 'application/json',
      'x-api-market-key': 'API_KEY',
      'Content-Type': 'application/json'
    }
  }
);
```

{% endtab %}

{% tab title="Javscript" %}

```javascript
fetch('https://prod.api.market/api/v1/magicapi/captioner/captioner', {
  method: 'POST',
  headers: {
    'accept': 'application/json',
    'x-api.market': 'API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    'image': 'https://telegra.ph/file/e4a72c3fc980534f4eb45.png',
    'task': 'image_captioning'
  })
});
```

{% endtab %}
{% endtabs %}

```json
{
  "request_id": REQUEST_ID
}
```

**Get the result**

{% tabs %}
{% tab title="Curl" %}

```bash
curl -X 'GET' \
  'https://prod.api.market/api/v1/magicapi/captioner/predictions/REQUEST_ID' \
  -H 'accept: application/json' \
  -H 'x-api-market-key: API_KEY'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

headers = {
    'accept': 'application/json',
    'x-api-market-key': 'API_KEY',
}

response = requests.get('https://prod.api.market/api/v1/magicapi/captioner/predictions/REQUEST_ID', headers=headers)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://prod.api.market/api/v1/magicapi/captioner/predictions/REQUEST_ID');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'accept: application/json',
    'x-api-market-key: API_KEY',
]);

$response = curl_exec($ch);

curl_close($ch);
```

{% endtab %}

{% tab title="NodeJs" %}

```javascript
import axios from 'axios';

const response = await axios.get('https://prod.api.market/api/v1/magicapi/captioner/predictions/REQUEST_ID', {
  headers: {
    'accept': 'application/json',
    'x-api-market-key': 'API_KEY'
  }
});
```

{% endtab %}

{% tab title="Javscript" %}

```javascript
fetch('https://prod.api.market/api/v1/magicapi/captioner/predictions/REQUEST_ID', {
  headers: {
    'accept': 'application/json',
    'x-api-market-key': 'API_KEY'
  }
});
```

{% endtab %}
{% endtabs %}

```json
{
  "status": "succeeded",
  "result": "RESULT_DESCRIPTION"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.api.market/api-product-docs/magicapi/image-captioner-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
