<commit_before>===================
ScaleAPI for Python
===================


Installation
============
.. code-block:: bash

    $ pip install --upgrade scaleapi
    
Note: We strongly suggest using `scaleapi` with Python version 2.7.9 or greater due to SSL issues with prior versions.

Usage
=====
.. code-block:: python

    import scaleapi
    client = scaleapi.ScaleClient('YOUR_API_KEY_HERE')

Tasks
=====

Most of these methods will return a ``scaleapi.Task`` object, which will contain information
about the json response (task_id, status...).

Any parameter available in the documentation_ can be passed as an argument option with the corresponding type.

.. _documentation: https://scale.com/docs

The following endpoints for tasks are available:

Create Categorization Task
==========================

Check `this`__ for further information.

__ https://scale.com/docs/#create-categorization-task

.. code-block:: python

    task = client.create_categorization_task(
      callback_url='http://www.example.com/callback',
      instruction='Is this company public or private?',
      attachment_type='website',
      attachment='http://www.google.com/',
      categories=['public', 'private']
    )

Create Annotation Task
======================

Check `this`__ for further information.

__ https://scale.com/docs/#2d-box-annotation

.. code-block:: python

    client.create_annotation_task(
      callback_url='http://www.example.com/callback',
      instruction='Draw a box around each baby cow and big cow.',
      attachment_type="image",
      attachment="http://i.imgur.com/v4cBreD.jpg",
      objects_to_annotate=["baby cow", "big cow"]
    )

Retrieve task<commit_msg>Fix up Image Annotation in Readme<commit_after>===================
ScaleAPI for Python
===================


Installation
============
.. code-block:: bash

    $ pip install --upgrade scaleapi
    
Note: We strongly suggest using `scaleapi` with Python version 2.7.9 or greater due to SSL issues with prior versions.

Usage
=====
.. code-block:: python

    import scaleapi
    client = scaleapi.ScaleClient('YOUR_API_KEY_HERE')

Tasks
=====

Most of these methods will return a ``scaleapi.Task`` object, which will contain information
about the json response (task_id, status...).

Any parameter available in the documentation_ can be passed as an argument option with the corresponding type.

.. _documentation: https://scale.com/docs

The following endpoints for tasks are available:

Create Categorization Task
==========================

Check `this`__ for further information.

__ https://scale.com/docs/#create-categorization-task

.. code-block:: python

    task = client.create_categorization_task(
      callback_url='http://www.example.com/callback',
      instruction='Is this company public or private?',
      attachment_type='website',
      attachment='http://www.google.com/',
      categories=['public', 'private']
    )

Create Image Annotation Task
======================

Check `this`__ for further information.

__ https://docs.scale.com/reference#general-image-annotation

.. code-block:: python

    client.create_imageannotation_task(
      callback_url = 'http://www.example.com/callback',
      instruction= 'Draw a box around each baby cow and big cow.',
      attachment_type = "image",
      attachment = "http://i.imgur.com/v4cBreD.jpg",
      geometries= {
        "box": {
          "objects_to_annotate: ["Baby Cow", "Big Cow"],
          "min_height": 10,
          "min_width": 10
        }
      }
    )

Retrieve task
{'fraction_non_alphanumeric': 0.15998871331828443, 'fraction_numerical': 0.003668171557562077, 'mean_word_length': 3.6953642384105962, 'pattern_counts': {'":': 3, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5465431', 'n_tokens_mistral': 996, 'n_tokens_neox': 956, 'n_words': 292}