> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getlimina.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# クイックスタートガイド

> このクイックスタートガイドでは、Limina コンテナの PII 検出、秘匿化機能のローカルセットアップを説明します。

このガイドでは Limina コンテナのセットアップ方法について説明します。

<Info>
  Limina クラウド API (無償デモ版) を利用されたい場合は、[ポータルアカウント](https://portal.getlimina.ai) を作成しサンプルコードを実行することができます。
</Info>

## コンテナのセットアップ

Limina コンテナはオンプレミス、任意のクラウド環境にデプロイできます。多くのケースで AWS、Azure をご利用頂いています。本番環境へのデプロイには [Kubernetes](/installation/kubernetes-setup-guide) を推奨しています。[インストールガイド](/installation/prerequisites-and-system-requirements) もご参照ください。

### **カスタマーポータルへのログイン**

ご契約頂いたお客様には弊社とのオンボーディングプロセスの開始時に、カスタマーポータルアカウントが発行されます。各種リンク、ライセンスファイルのご提供、弊社コンテナレジストリへのログイン、コンテナイメージの Pull 手順等が確認できます。

オンボーディング時のご不明な点に関しては、お客様専用の Slack チャネル経由でカスタマーサポートチームにご連絡ください。メール [support@getlimina.ai](mailto:support@getlimina.ai) でお問い合わせ頂くこともできます。

### **コンテナイメージの取得**

カスタマーポータルにアクセス可能になりましたら、最新のコンテナ取得のためのコマンドを確認できます。Limina コンテナは弊社の Azure コンテナレジストリに置かれています。レジストリへのログインコマンドは以下となります。

```shell Docker コマンド wrap theme={"theme":"poimandres"}
docker login -u INSERT_UNIQUE_CLIENT_ID -p INSERT_UNIQUE_CLIENT_PW crprivateaiprod.azurecr.io
```

ログインに問題がある場合にはカスタマーサポートにご連絡ください。

### **ライセンスファイルの取得**

カスタマーポータルからライセンスファイルも取得頂くようになっています。メインページをご確認ください。ダウンロードリンク、ライセンス体系の情報、ライセンス失効日などが確認できます。

### **コンテナの取得と起動**

バージョン 3.0 より、ライセンスファイルは認証に使用されます。コンテナ起動時にライセンスファイルをマウントします。

```shell Docker コマンド wrap theme={"theme":"poimandres"}
docker run --rm -v "full path to your license.json file":/app/license/license.json \
-p 8080:8080 -it crprivateaiprod.azurecr.io/deid:<tag>
```

サンプル:

```shell Docker コマンド wrap theme={"theme":"poimandres"}
docker run --rm -v "/home/johnsmith/paisandbox/my-license-file.json":/app/license/license.json \
-p 8080:8080 -it crprivateaiprod.azurecr.io/deid:3.0.0-cpu
```

## 秘匿化リクエストの送信

コンテナ上のエンドポイントへ向け、秘匿化リクエストを送信する例を示します。

<CodeGroup>
  ```json Request Body lines theme={"theme":"poimandres"}
  {
    "text": [
      "Hello John"
    ]
  }
  ```

  ```shell cURL wrap lines theme={"theme":"poimandres"}
  curl --request POST --url http://localhost:8080/process/text --header 'Content-Type: application/json' --data '{"text": ["Hello John"]}'
  ```

  ```python Python wrap lines theme={"theme":"poimandres"}
  import requests

  r = requests.post(url="http://localhost:8080/process/text",
                    json={"text": ["Hello John"]})

  results = r.json()

  print(results)
  ```

  ```python Python Client wrap lines theme={"theme":"poimandres"}
  from privateai_client import PAIClient
  from privateai_client import request_objects

  client = PAIClient(url="https://api.private-ai.com/community/v4/", api_key='<YOUR API KEY>')

  text_request = request_objects.process_text_obj(text=["Hello John"])
  response = client.process_text(text_request)

  print(response.processed_text)
  ```
</CodeGroup>

### **ファイルの秘匿化処理**

base64 エンコード方式でファイル秘匿化リクエストを送信する場合のエンドポイントは `/process/files/base64` です。

<CodeGroup>
  ```json Request Body lines theme={"theme":"poimandres"}
  {
    "file": {
      "data": "<file_content_base64>",
      "content_type": "image/jpg"
    }
  }
  ```

  ```shell cURL wrap lines theme={"theme":"poimandres"}
  echo '{"file": {"data": "'$(base64 -w 0 sample.jpg)'", "content_type": "image/jpg"}}' \
  | curl --request POST --url 'http://localhost:8080/process/files/base64' \
  -H 'Content-Type: application/json' -d @- | jq -r .processed_file | base64 -d > 'sample.redacted.jpeg'
  ```

  ```python Python wrap lines theme={"theme":"poimandres"}
  import base64
  import requests

  # インプット、アウトプットファイルの指定
  filename_in = "<input filename>"
  filename_out = "<output filename>"

  # ファイルの読み取りとエンコード
  with open(filename_in, "rb") as f:
      b64_file_content = base64.b64encode(f.read())
      b64_file_content = b64_file_content.decode("utf-8")

  # リクエストの作成と結果の取得
  r = requests.post(url="http://localhost:8080/process/files/base64",
                    json={"file": {"data": b64_file_content, "content_type": "image/jpg"}})
  results = r.json()

  # デコードとファイルへの出力
  with open(filename_out, "wb") as f:
      f.write(base64.b64decode(results["processed_file"]))
  ```

  ```python Python Client wrap lines theme={"theme":"poimandres"}
  from privateai_client import PAIClient
  from privateai_client.objects import request_objects
  import base64

  # インプット、アウトプットファイルの指定
  filename_in = "sample.pdf"
  filename_out = "sample.redacted.pdf"

  file_type= "application/pdf"
  client = PAIClient(url="https://api.private-ai.com/community/v4/", api_key='<YOUR API KEY>')

  # ファイルの読み取り
  with open(filename_in, "rb") as b64_file:
      file_data = base64.b64encode(b64_file.read())
      file_data = file_data.decode("ascii")

  # リクエストの作成
  file_obj = request_objects.file_obj(data=file_data, content_type=file_type)
  request_obj = request_objects.file_base64_obj(file=file_obj)
  resp = client.process_files_base64(request_object=request_obj)

  # ファイルへの出力
  with open(filename_out, 'wb') as redacted_file:
      processed_file = resp.processed_file.encode("ascii")
      processed_file = base64.b64decode(processed_file, validate=True)
      redacted_file.write(processed_file)
  ```
</CodeGroup>

直接ファイルを受け付けるには `/process/files/uri` がエンドポイントになります。こちらでは base64 エンコードのオーバーヘッドを削減し、リクエストへのセンシティブな情報付加を削減できます。[コンテナの実行](/installation/running-the-container) を合わせてご覧ください。
