testComplianceLocal / README.md
howard9963's picture
Update README.md
168b1a9 verified
---
title: TestComplianceLocal
emoji: 📊
colorFrom: gray
colorTo: gray
sdk: gradio
sdk_version: 5.42.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: 測試法遵自評
---
# 法遵自評覆核系統(Hugging Face 版)
本專案提供一個基於 **Gradio** 的 Web UI,結合 **PaddleOCR****Meta-LLaMA-3.1-8B-Instruct** 模型,用於上傳內規與自評資料並自動檢核是否符合規範。支援 PDF 文字擷取與 OCR(含繁體中文)。
---
## 功能特色
- 上傳多份 **單位適用內規**(支援 TXT 與 PDF,PDF 自動判斷是否需 OCR)
- 單位自評可直接輸入文字或透過附件上傳
- 上傳多份 **自評附件**
- 使用 **PaddleOCR** 支援中英文與繁體中文 OCR
- 本地推論 **Meta-LLaMA-3.1-8B-Instruct**
- Debug Log 即時顯示處理流程
---
## 環境變數設定
| 變數名稱 | 範例值 | 說明 |
|----------|--------|------|
| `HF_TOKEN` | `hf_xxxxxxxxx` | Hugging Face Access Token(需對 LLaMA 模型有存取權限) |
| `DEVICE` | `cuda``cpu` | 推論設備(預設自動判斷) |
| `OCR_LANG` | `ch` | OCR 語言:`ch`(中英混合)、`ch_tra`(繁體)、`en`(英文) |
| `MODEL_PATH` | `/data/meta-llama/Meta-Llama-3.1-8B-Instruct` | 模型路徑(可選) |
| `CONFIG_PATH` | `/home/user/app/config/config.json` | 設定檔路徑(可選) |
| `PORT` | `7860` | Web UI 埠號(預設 Hugging Face 自動設定) |
在 Hugging Face Spaces 可於 **Settings → Variables and secrets** 中設定以上變數。
---
設定需要在於A10G Large/Persistent Storage 150G以上環境執行
## 安裝
```bash
pip install -r requirements.txt
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference