Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

👤 Azure AI Foundry 的 PII 偵測範例

本範例說明如何使用微軟 Azure AI Foundry 的 PII 偵測功能。請依下列步驟完成環境設定與 Jupyter Notebook執行。

步驟一:準備環境

  • Python 環境

    • Python 版本至少 3.8
    • 此專案的 pyproject.toml 是指定 requires-python == 3.11.12,僅供參考
    • 檢查 Python 版本,以 Windows 環境為例,透過 PowerShell 執行
      python --version
  • Azure AI Foundry 資源

    • 前往 Azure AI Foundry Portal:https://ai.azure.com/

    • 新增或找到既有的 AI 專案,並進入專案頁面

    • 前往「Endpoints and keys」或「端點與金鑰」查看,如下圖所示 complete

    • 取得 Azure AI Services 的 Endpoint 與 Key,將於步驟五中使用

      • AI_SERVICES_ENDPOINT
      • AI_SERVICES_KEY

步驟二:下載 Repo

  • 使用 Git:

    git clone https://github.com/ownway22/azure-pii-sample-code.git
    cd <你的-repo資料夾>/azure-pii-sample-code
  • 或直接將本資料夾下載到本機。

步驟三:啟動虛擬環境

  • 在 <你的-repo資料夾>/azure-pii-sample-code 目錄下執行:
    python -m venv .venv                # 建立虛擬環境
    .venv\Scripts\Activate              # 啟動虛擬環境

步驟四:安裝相依套件

  • 本專案提供 requirements.txt 和 pyproject.toml 做安裝
  • 以 requirements.txt 為例
    python -m pip install --upgrade pip # 升級 pip
    pip install -r requirements.txt     # 安裝相依套件

步驟五:準備環境變數

  • 將 .env_example 另存為 .env
  • 貼上步驟一的 Endpoint 與 Key

步驟六:執行 azure-pii-code-sample.ipynb

  • 建議以 VS Code 開啟 azure-pii-code-sample.ipynb,並選擇 .venv 作為 Notebook Kernel,逐格執行。

注意事項

  • 本範例使用的環境變數名稱為 AI_SERVICES_ENDPOINT 與 AI_SERVICES_KEY(可參考 .env_example)。
  • 若執行過程遇到套件安裝問題,請確認你啟動的是此資料夾下的 .venv,並重試安裝指令。

Reference

  1. Quickstart: Detect Personally Identifiable Information (PII) | Microsoft Learn

  2. Quickstart: using the Language Detection client library and REST API | Microsoft Learn

  3. sample_recognize_pii_entities.py | Github

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages