From a2b63f0bf42aecef90727746e94027e48fde471f Mon Sep 17 00:00:00 2001 From: Chendi Xue Date: Thu, 20 Jun 2024 22:44:12 +0000 Subject: [PATCH] remove model specification in README Signed-off-by: Chendi Xue --- comps/guardrails/pii_detection/README.md | 14 ++++---------- comps/guardrails/pii_detection/data_utils.py | 1 - comps/guardrails/pii_detection/pii_detection.py | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/comps/guardrails/pii_detection/README.md b/comps/guardrails/pii_detection/README.md index 202198dc7..f98cea444 100644 --- a/comps/guardrails/pii_detection/README.md +++ b/comps/guardrails/pii_detection/README.md @@ -22,18 +22,12 @@ python pii_detection.py ## 2.1 Prepare PII detection model +export HUGGINGFACEHUB_API_TOKEN=${HP_TOKEN} + ## 2.1.1 use LLM endpoint (will add later) intro placeholder -## 2.1.2 use NER model (default mode) - -```bash -mkdir -p pii/bigcode -apt install git-lfs -cd pii/bigcode; git clone https://{hf_username}:{hf_token}@huggingface.co/bigcode/starpii/; cd ../.. -``` - ## 2.2 Build Docker Image ```bash @@ -44,13 +38,13 @@ docker build -t opea/guardrails-pii-detection:latest --build-arg https_proxy=$ht ## 2.3 Run Docker with CLI ```bash -docker run -d --rm --runtime=runc --name="guardrails-pii-detection-endpoint" -p 6357:6357 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy opea/guardrails-pii-detection:latest +docker run -d --rm --runtime=runc --name="guardrails-pii-detection-endpoint" -p 6357:6357 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} opea/guardrails-pii-detection:latest ``` > debug mode ```bash -docker run --rm --runtime=runc --name="guardrails-pii-detection-endpoint" -p 6357:6357 -v ./comps/guardrails/pii_detection/:/home/user/comps/guardrails/pii_detection/ --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy opea/guardrails-pii-detection:latest +docker run --rm --runtime=runc --name="guardrails-pii-detection-endpoint" -p 6357:6357 -v ./comps/guardrails/pii_detection/:/home/user/comps/guardrails/pii_detection/ --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} opea/guardrails-pii-detection:latest ``` # 🚀3. Get Status of Microservice diff --git a/comps/guardrails/pii_detection/data_utils.py b/comps/guardrails/pii_detection/data_utils.py index dfafbc670..29e9c4196 100644 --- a/comps/guardrails/pii_detection/data_utils.py +++ b/comps/guardrails/pii_detection/data_utils.py @@ -164,7 +164,6 @@ def load_svg(svg_path): return text -@timeout(600) def document_loader(doc_path): if doc_path.endswith(".pdf"): return load_pdf(doc_path) diff --git a/comps/guardrails/pii_detection/pii_detection.py b/comps/guardrails/pii_detection/pii_detection.py index 8f73a4e4e..b49ac7065 100644 --- a/comps/guardrails/pii_detection/pii_detection.py +++ b/comps/guardrails/pii_detection/pii_detection.py @@ -38,7 +38,7 @@ def get_pii_detection_inst(strategy="dummy", settings=None): if strategy == "ner": - return PIIDetectorWithNER(model_path="pii") + return PIIDetectorWithNER() elif strategy == "ml": return PIIDetectorWithML() elif strategy == "llm":