> ## Documentation Index
> Fetch the complete documentation index at: https://unstructured-53-kapa-ai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Clarifai

> Batch process all your records using `unstructured-ingest` to store unstructured outputs locally on your filesystem and upload those to Clarifai apps.

First start with the installation of clarifai dependencies as shown here.

```bash
pip install "unstructured[clarifai]"

```

Create a clarifai app with base workflow. Find more information in the [create clarifai app](https://docs.clarifai.com/clarifai-basics/applications/create-an-application/).

## Run Locally

<CodeGroup>
  ```bash Shell
  #!/usr/bin/env bash

  unstructured-ingest \
    local \
    --input-path example-docs/book-war-and-peace-1225p.txt \
    --output-dir local-output-to-clarifai \
    --strategy fast \
    --chunk-elements \
    --num-processes 2 \
    --verbose \
    clarifai \
    --app-id "$CLARIFAI_APP_ID" \
    --user-id "$CLARIFAI_USER_ID" \
    --api-key "$CLARIFAI_PAT_KEY" \
    --batch-size 100
  ```

  ```python Python
  import os

  from unstructured.ingest.connector.clarifai import (
      ClarifaiAccessConfig,
      ClarifaiWriteConfig,
      SimpleClarifaiConfig,
  )
  from unstructured.ingest.connector.local import SimpleLocalConfig
  from unstructured.ingest.interfaces import (
      ChunkingConfig,
      PartitionConfig,
      ProcessorConfig,
      ReadConfig,
  )
  from unstructured.ingest.runner import LocalRunner
  from unstructured.ingest.runner.writers.base_writer import Writer
  from unstructured.ingest.runner.writers.clarifai import (
      ClarifaiWriter,
  )


  def get_writer() -> Writer:
      return ClarifaiWriter(
          connector_config=SimpleClarifaiConfig(
              access_config=ClarifaiAccessConfig(api_key=os.getenv("CLARIFAI_PAT_KEY")),
              app_id=os.getenv("CLARIFAI_APP_ID"),
              user_id=os.getenv("CLARIFAI_USER_ID"),
          ),
          write_config=ClarifaiWriteConfig(),
      )


  if __name__ == "__main__":
      writer = get_writer()
      runner = LocalRunner(
          processor_config=ProcessorConfig(
              verbose=True,
              output_dir="local-output-to-clarifai-app",
              num_processes=2,
          ),
          connector_config=SimpleLocalConfig(
              input_path="example-docs/book-war-and-peace-1225p.txt",
          ),
          read_config=ReadConfig(),
          partition_config=PartitionConfig(),
          chunking_config=ChunkingConfig(chunk_elements=True),
          writer=writer,
          writer_kwargs={},
      )
      runner.run()
  ```
</CodeGroup>

The upstream connector can be any of the ones supported, but for the convenience here, showing a sample command using the upstream local connector.

For a full list of the options the CLI accepts check `unstructured-ingest <upstream connector> clarifai --help`.

NOTE: Keep in mind that you will need to have all the appropriate extras and dependencies for the file types of the documents contained in your data storage platform if you’re running this locally. You can find more information about this in the [installation guide](/open-source/installation/overview).
