### Install and Run OpenMed Example Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/index.md Shows how to install the OpenMed library with Hugging Face support using `uv` and then run a Python example script. This is a common workflow for setting up and testing OpenMed functionalities. ```bash uv pip install "openmed[hf]" uv run python examples/pii_model_comparison.py ``` -------------------------------- ### Install uv and OpenMed with Extras Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/getting-started.md Install uv for dependency management and then install OpenMed with specific extras like Hugging Face support and documentation tooling. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh # install uv (skip if already installed) uv venv --python 3.11 # create a dedicated virtualenv source .venv/bin/activate # or use `uv python` directly # install OpenMed with Hugging Face extras and doc tooling uv pip install ".[hf]" ``` -------------------------------- ### Setup OpenMed Environment Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/custom_tokenizer/README.md Installs necessary dependencies and the OpenMed package in a virtual environment. ```bash python -m venv .venv-openmed source .venv-openmed/bin/activate pip install -r requirements.txt pip install -e . # from repo root to get openmed package ``` -------------------------------- ### Set Up Development Environment Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/onboarding.md Clone the repository, create a virtual environment, and install development dependencies. Optionally, install pre-commit hooks. ```bash # Fork and clone the repo git clone https://github.com//openmed.git cd openmed # Create the local virtual environment and install dev dependencies uv venv uv pip install -e ".[dev]" # (Optional) Install pre-commit hooks pre-commit install ``` -------------------------------- ### Install Service Dependencies Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/rest-service.md Installs the necessary dependencies for the service using uv pip. Ensure you are in the project root directory. ```bash uv pip install -e ".[hf,service]" ``` -------------------------------- ### Install and Run Privacy Filter Studio Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/privacy_filter_studio/README.md Install the necessary packages and run the Uvicorn server to launch the Privacy Filter Studio. Ensure you use the correct installation command based on your environment (Apple Silicon vs. other hosts). ```bash pip install -e " B.[mlx,service]" # or ".[hf,service]" off Apple Silicon python -m uvicorn examples.privacy_filter_studio.app:app --reload --port 8770 ``` -------------------------------- ### Install MLX Backend and Check Backend Type Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/examples.md Installs the MLX backend and verifies the backend type using a Python one-liner. Ensure you have the necessary dependencies installed. ```bash uv pip install "".[mlx]" uv run python -c "from openmed.core.backends import get_backend; print(type(get_backend()).__name__)" ``` -------------------------------- ### Install OpenMED Service Source: https://github.com/maziyarpanahi/openmed/blob/master/README.md Installs the necessary packages for the OpenMED service and starts the uvicorn server. Ensure you have Docker installed for the Docker command. ```bash pip install "openmed[hf,service]" uvicorn openmed.service.app:app --host 0.0.0.0 --port 8080 # or with Docker docker build -t openmed:1.6.0 . docker run --rm -p 8080:8080 -e OPENMED_PROFILE=prod openmed:1.6.0 ``` -------------------------------- ### Install Documentation Dependencies and Serve Locally Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/contributing.md Install dependencies required for documentation building and serve the MkDocs preview locally with hot reloading. Also includes commands to inspect the built site. ```bash uv pip install ".[docs]" uv run mkdocs serve -a 127.0.0.1:8008 make docs-stage python3 -m http.server --directory site 9000 ``` -------------------------------- ### Install OpenMed and Testing Dependencies Source: https://github.com/maziyarpanahi/openmed/blob/master/tests/README.md Install the package in editable mode with testing dependencies. Ensure transformers and optionally torch are installed. ```bash # from the repository root git clone https://github.com/maziyarpanahi/openmed.git cd openmed python -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate pip install -e . pip install pytest pytest-cov transformers # Optional: install a CPU backend for transformers pip install torch --index-url https://download.pytorch.org/whl/cpu ``` -------------------------------- ### Start API Server with Development Profile Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/rest-service.md Starts the API server using the 'dev' profile. This profile might enable additional debugging or development-specific features. ```bash OPENMED_PROFILE=dev uvicorn openmed.service.app:app --host 0.0.0.0 --port 8080 ``` -------------------------------- ### Install Dependencies and Run Linters Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/testing.md Installs development and Hugging Face dependencies, then runs linting and formatting checks. Use this command to ensure code quality and style compliance. ```bash uv pip install "[dev,hf]" make lint make format-check make lint-swift # for Swift/OpenMedKit changes ``` -------------------------------- ### Install OpenMed Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/website/index.html Install the OpenMed library using pip. Use the `mlx` extra for MLX acceleration. ```bash pip install openmed[mlx] ``` -------------------------------- ### Install OpenMed with REST Service Source: https://github.com/maziyarpanahi/openmed/blob/master/README.md Install OpenMed with the Hugging Face runtime and the REST service for API access. ```bash pip install "openmed[hf,service]" ``` -------------------------------- ### Install Development Dependencies and Format Code Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/contributing.md Install the necessary development dependencies and apply canonical code formatting and linting using Ruff. This ensures consistency with CI checks. ```bash uv pip install -e ".[dev]" make format make lint make format-check ``` -------------------------------- ### Quick Start: Text Generation with MLX-LM Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/mlx-backend.md Generate text using MLX-LM causal language models with OpenMed. This example uses the 'OpenMed/laneformer-2b-it-q4-mlx' model for text generation. ```python from openmed import generate_text response = generate_text( messages=[ { "role": "user", "content": "Explain why local clinical language models matter.", } ], model_name="OpenMed/laneformer-2b-it-q4-mlx", max_tokens=128, ) print(response) ``` -------------------------------- ### Install Combined OpenMed Extras Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/getting-started.md Install Hugging Face, MLX runtime, and documentation extras for a full launch surface on one machine. ```bash uv pip install ".[hf,mlx,docs]" ``` -------------------------------- ### Install OpenMed with spaCy extras Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/spacy-component.md Install OpenMed including the necessary spaCy integration. ```bash pip install "openmed[spacy]" ``` -------------------------------- ### Install OpenMed with PaddleOCR Backend Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/getting-started.md Install the PaddleOCR backend for a heavier opt-in OCR solution. ```bash uv pip install ".[ocr-paddle]" ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/security/secret-handling.md Install the repository's pre-commit hooks to enforce local checks before committing code. This includes secret scanning. ```bash pre-commit install ``` -------------------------------- ### Install OpenMed Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/notebooks/PII_Detection_Complete_Guide.ipynb Install the OpenMed library using pip. This is a prerequisite for using any of its functionalities. ```bash pip install openmed ``` -------------------------------- ### Start API Server Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/rest-service.md Starts the FastAPI API server locally. This command assumes the 'app' object is correctly defined in 'openmed.service.app'. ```bash uvicorn openmed.service.app:app --host 0.0.0.0 --port 8080 ``` -------------------------------- ### Example Custom Profile File (TOML) Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/profiles.md Illustrates the structure and content of a custom profile stored in a TOML file. ```toml # OpenMed profile: myproject # Custom profile configuration log_level = "INFO" timeout = 450 device = "cuda" use_medical_tokenizer = true ``` -------------------------------- ### Setup: Import OpenMed API and Select Model Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/notebooks/Deidentification_Cookbook.ipynb Imports the necessary OpenMed API components and selects a lightweight English PII model for CPU-friendly runs. This setup is reused across all recipes. ```python import csv import tempfile from pathlib import Path from openmed import ( deidentify, reidentify, BatchProcessor, DEFAULT_PII_MODELS, ) # 44M English PII model - the lightest default, good for CPU-only runs. MODEL = DEFAULT_PII_MODELS["en"] print("Using model:", MODEL) # Shared synthetic notes (fabricated PHI). NOTES = [ "Patient John Doe (DOB 01/15/1970) called from 555-123-4567.", "Contact Jane Roe at jane.roe@example.com regarding MRN 00123456.", "Dr. Alan Grant reviewed the chart for Maria Lopez on 2025-03-02.", ] ``` -------------------------------- ### Preload Models at Startup Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/rest-service.md Starts the API server with specified models preloaded. Models are specified as a comma-separated list of registry aliases or Hugging Face IDs. ```bash OPENMED_SERVICE_PRELOAD_MODELS=disease_detection_superclinical,OpenMed/OpenMed-PII-SuperClinical-Small-44M-v1 \ uvicorn openmed.service.app:app --host 0.0.0.0 --port 8080 ``` -------------------------------- ### Add New Language Example Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/privacy_filter_multilingual_studio/README.md To add a new language or example to the studio, edit the `examples.py` file. Update `LANGUAGE_META` if the language is missing and add `StudioExample` tuples to `LANGUAGE_EXAMPLES` for the specific language code. No JavaScript changes are needed as the frontend automatically picks up these changes. ```python 1. Add the language to `LANGUAGE_META` if missing. 2. Add a tuple of `StudioExample(...)` entries to `LANGUAGE_EXAMPLES[code]`. ``` -------------------------------- ### Install Editable Package with Dev Dependencies Source: https://github.com/maziyarpanahi/openmed/blob/master/AGENTS.md Installs the package in editable mode along with dependencies required for development and testing. ```bash uv pip install -e ".[dev]" ``` -------------------------------- ### Install OpenMed with Apple Silicon Acceleration Source: https://github.com/maziyarpanahi/openmed/blob/master/README.md Install OpenMed with support for Apple Silicon acceleration using the MLX runtime. ```bash pip install "openmed[mlx]" ``` -------------------------------- ### Install GLiNER Optional Dependencies Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/zero-shot-ner.md Install the GLiNER optional dependencies using uv pip. Ensure GLiNER checkpoints are available locally for inference. ```bash uv pip install ".[gliner]" ``` -------------------------------- ### Install OpenMed with LangChain extras Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/integrations-langchain.md Install the OpenMed package with the necessary extras for LangChain integration. ```bash pip install "openmed[langchain]" ``` -------------------------------- ### Accessing Cold Start Latency Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/eval-harness.md Demonstrates how to access and print the cold start latency from a benchmark report. This metric is useful for observing model load overhead. ```python report = run_benchmark(fixtures, suite="my-suite", model_name="my-model", runner=runner) cold_ms = report.metrics["latency"]["cold_start_ms"] print(f"Cold-start latency: {cold_ms:.1f} ms") ``` -------------------------------- ### Start Jupyter Notebook Server Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/notebooks/README.md Launch the Jupyter notebook server from your terminal to access and run the notebooks. ```bash jupyter notebook ``` -------------------------------- ### Install OpenMed for OCR and Tesseract Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/getting-started.md Install the multimodal extra for scanned images and document OCR, along with the system Tesseract binary. ```bash uv pip install ".[multimodal]" brew install tesseract # macOS sudo apt-get install tesseract-ocr # Debian/Ubuntu ``` -------------------------------- ### Run Tokenization Comparison Example Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/medical-tokenizer.md Run the script to compare tokenization outputs from WordPiece, spaCy, and the medical pre-tokenizer on clinical text. ```bash .venv-openmed/bin/python examples/custom_tokenizer/eval_tokenization_comparison.py ``` -------------------------------- ### Install OpenMed with GLiNER or Dev Extras Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/getting-started.md Add GLiNER and transformers support, or install development tools like pytest and coverage. ```bash uv pip install ".[hf,gliner]" # add GLiNER + transformers uv pip install ".[dev]" # pytest + coverage + linting ``` -------------------------------- ### Show CLI Example for OpenMed Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/notebooks/Medical_Tokenizer_Demo.ipynb Illustrates the command-line interface usage for analyzing text with OpenMed, specifically showing how to disable the medical tokenizer. ```bash # Show CLI example (string, not executed here) cli_cmd = ( "openmed analyze --text " "COVID-19 patient on IL-6 inhibitor" " --no-medical-tokenizer" ) print("CLI example:", cli_cmd) ``` -------------------------------- ### Install Runtime Dependencies Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/notebooks/Sentence_Detection_Batching.ipynb Installs necessary libraries for OpenMed NER, including transformers, torch, and pysbd. Ensure you are in the project's virtual environment before running. ```bash uv pip install transformers==4.57.1 torch==2.9.0 --index-url https://download.pytorch.org/whl/cpu uv pip install pysbd==0.3.4 ``` -------------------------------- ### Install Editable Package with Hugging Face Dependencies Source: https://github.com/maziyarpanahi/openmed/blob/master/AGENTS.md Installs the package in editable mode, including Hugging Face dependencies for model-related tasks. ```bash uv pip install -e ".[dev,hf]" ``` -------------------------------- ### Start Docker Compose Services Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/rest-service.md Builds and starts the OpenMED service using Docker Compose. This command assumes a docker-compose.yml file is present in the current directory. ```bash docker compose up -d ``` -------------------------------- ### Run Custom Tokenizer Alignment Example Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/medical-tokenizer.md Execute the custom tokenizer alignment script to see how custom tokens are mapped through the model and back. ```bash .venv-openmed/bin/python examples/custom_tokenizer/custom_tokenize_alignment.py ``` -------------------------------- ### Run Privacy Filter App (Allow Downloads) Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/privacy_filter_book/README.md Starts the privacy filter application, allowing first-run Hugging Face downloads for MLX and CPU models. ```bash OPENMED_PRIVACY_FILTER_DOWNLOAD=1 uvicorn examples.privacy_filter_book.app:app --reload --port 8765 ``` -------------------------------- ### Install OpenMed and Jupyter Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/notebooks/README.md Use uv pip to install OpenMed with HuggingFace support and Jupyter for running notebooks. Additional packages may be needed for PII-related notebooks. ```bash uv pip install "openmed[hf]" uv pip install jupyter # For PII notebooks, you may need: uv pip install matplotlib ipython ``` -------------------------------- ### Install OpenMed with Hugging Face Runtime Source: https://github.com/maziyarpanahi/openmed/blob/master/README.md Install the core OpenMed library along with the Hugging Face runtime for CPU or CUDA support on Linux, macOS, and Windows. ```bash pip install "openmed[hf]" ``` -------------------------------- ### Example Profile Report Output Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/profiling.md A human-readable format for performance profiling reports, showing total duration, operation count, and a breakdown of individual timings with percentages. ```text Performance Profile Report ================================================== Total Duration: 1234.56ms Operations: 4 Timings: -------------------------------------------------- inference.forward 856.23ms ( 69.4%) model_loading 312.45ms ( 25.3%) postprocessing 45.67ms ( 3.7%) preprocessing 20.21ms ( 1.6%) ``` -------------------------------- ### Run Privacy Filter App (Default) Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/privacy_filter_book/README.md Starts the privacy filter application with default settings, prioritizing cached local models. ```bash uvicorn examples.privacy_filter_book.app:app --reload --port 8765 ``` -------------------------------- ### Sample Automation Pipeline for CI Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/examples.md A bash script to automate the installation of dependencies, running PII model comparison, building documentation, and performing smoke tests for GLiNER models. Useful for CI/CD pipelines. ```bash #!/usr/bin/env bash set -euo pipefail uv pip install "".[hf,docs]" python examples/pii_model_comparison.py > artifacts/result.txt uv run mkdocs build --strict python scripts/smoke_gliner.py --limit 1 --threshold 0.5 ``` -------------------------------- ### Get OpenMed Version Source: https://github.com/maziyarpanahi/openmed/blob/master/SECURITY.md Use this command to retrieve the installed version of OpenMed. This is useful for reporting vulnerabilities. ```bash python -c "import openmed; print(openmed.__version__)" ``` -------------------------------- ### Serve or Build MkDocs Documentation Source: https://github.com/maziyarpanahi/openmed/blob/master/AGENTS.md Commands to either serve the documentation locally for preview or to perform a strict build of the MkDocs documentation. ```bash make docs-serve / make docs-build ``` -------------------------------- ### Install OpenMed with MLX extras Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/mlx-backend.md Install OpenMed with the necessary MLX dependencies from the repository root. This command installs MLX, MLX-LM, and related libraries. ```bash pip install -e ".[mlx]" ``` -------------------------------- ### Install OpenMed and Dependencies Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/notebooks/getting_started.ipynb Installs the OpenMed library and necessary dependencies like transformers and torch. ```python # Install OpenMed %pip install openmed # Install required dependencies %pip install transformers torch ``` -------------------------------- ### Swift MLX Quick Start Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/mlx-backend.md Demonstrates how to download an MLX model and initialize OpenMed with the MLX backend in Swift. This is useful for running OpenMed MLX artifacts directly within Apple applications on Apple Silicon. ```swift import OpenMedKit let modelDirectory = try await OpenMedModelStore.downloadMLXModel( repoID: "OpenMed/OpenMed-PII-ClinicalE5-Small-33M-v1-mlx" ) let openmed = try OpenMed( backend: .mlx(modelDirectoryURL: modelDirectory) ) let entities = try openmed.analyzeText( "Patient John Doe, DOB 1990-05-15, SSN 123-45-6789" ) ``` -------------------------------- ### Run Full Test Suite Source: https://github.com/maziyarpanahi/openmed/blob/master/tests/README.md Execute all unit and integration tests from the project root directory. ```bash pytest ``` -------------------------------- ### Manual Local Package Build and Publish Source: https://github.com/maziyarpanahi/openmed/blob/master/scripts/README.md Manually build the package using 'python3 -m build' and then publish it locally using 'hatch publish'. This is an alternative to the CI process. ```bash python3 -m build hatch publish ``` -------------------------------- ### Install OpenMed MLX Runtime Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/getting-started.md Install the Python MLX runtime, tokenizer, and artifact dependencies for Apple Silicon Macs. ```bash uv pip install ".[mlx]" # Python MLX runtime + tokenizer/artifact deps uv run python -c "from openmed.core.backends import get_backend; print(type(get_backend()).__name__)" ``` -------------------------------- ### Run Swift Package Tests Source: https://github.com/maziyarpanahi/openmed/blob/master/AGENTS.md Navigates to the Swift package directory and executes its tests. ```bash cd swift/OpenMedKit && swift test ``` -------------------------------- ### Install OpenMed with AWQ support Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/export-awq.md Install OpenMed with the 'awq' extra to include the AutoAWQ dependency. This ensures the quantization functionality is available. ```bash uv pip install -e ".[awq]" ``` -------------------------------- ### Timeout Error Example Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/rest-service.md An example of the error envelope when a request exceeds the configured timeout. The 'details' field includes the timeout duration. ```json { "error": { "code": "timeout", "message": "Request exceeded configured timeout of 300 seconds", "details": { "timeout_seconds": 300 } } } ``` -------------------------------- ### Build Project Wheels and Source Distributions Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/contributing.md Generate distributable package formats (wheels and sdists) for the project. This is a prerequisite for publishing to PyPI. ```bash python3 -m build ``` -------------------------------- ### Install OpenMed with Optional Extras Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/notebooks/ZeroShot_NER_Tour.ipynb Install OpenMed with the GLiNER and Hugging Face extras for zero-shot NER capabilities. This command is run from the shell. ```bash pip install ".[hf,gliner]" ``` ```bash pip install ".[hf,gliner]" ``` -------------------------------- ### Example PII Visualization Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/notebooks/PII_Detection_Complete_Guide.ipynb Demonstrates PII detection and visualization on a sample text. It uses `extract_pii` and the `highlight_entities` function. Ensure the model and confidence threshold are appropriately set. ```python viz_text = """Patient: Dr. Sarah Johnson DOB: 03/15/1975 SSN: 123-45-6789 Phone: (555) 123-4567 Email: sarah.j@email.com Address: 456 Oak Ave, Boston, MA 02115""" viz_result = extract_pii( viz_text, model_name='openmed/OpenMed-PII-SuperClinical-Large-434M-v1', confidence_threshold=0.5, use_smart_merging=True ) print("=" * 80) print("VISUALIZATION: Highlighted PII Entities") print("=" * 80) print("\nHover over highlighted text to see entity type and confidence.\n") html = highlight_entities(viz_result.text, viz_result.entities) display(HTML(html)) print("\nLegend:") print(" 🟥 Pink: Names") print(" 🟩 Green: Dates") print(" 🟦 Blue: SSN") print(" 🟨 Yellow: Phone") print(" 🟧 Orange: Email") print(" 🟪 Purple: Address") ``` -------------------------------- ### Validation Error Example Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/rest-service.md An example of the error envelope when a request fails validation. The 'details' field provides specific information about the validation failures. ```json { "error": { "code": "validation_error", "message": "Request validation failed", "details": [ { "field": "body.text", "message": "Text must not be blank", "type": "value_error" } ] } } ``` -------------------------------- ### Install Missing Package Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/notebooks/README.md Use this command to install a missing Python package when encountering an ImportError. Ensure 'package-name' is replaced with the actual name of the required package. ```python # Solution: Install missing package !pip install package-name ``` -------------------------------- ### Create and Save a Custom Profile (Python) Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/profiles.md Define custom settings and save them as a new profile using the save_profile function. This allows for reusable custom configurations. ```python from openmed.core.config import save_profile settings = { "log_level": "INFO", "timeout": 450, "device": "cuda", "use_medical_tokenizer": True, } save_profile("myproject", settings) ``` -------------------------------- ### Quick Start: PII Detection with MLX Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/mlx-backend.md Analyze text for PII using the MLX backend. MLX is automatically detected on Apple Silicon, so no explicit configuration is needed for this basic usage. ```python from openmed import analyze_text from openmed.core.config import OpenMedConfig # MLX is auto-detected on Apple Silicon — no config needed result = analyze_text( "Patient John Doe, DOB 1990-05-15, SSN 123-45-6789", model_name="pii_detection", ) print(result.entities) ``` -------------------------------- ### Install OpenMed with Hugging Face support Source: https://github.com/maziyarpanahi/openmed/blob/master/examples/notebooks/Multilingual_PII_Detection_Guide.ipynb Install the OpenMed library with Hugging Face integration using pip. This is required for using the library's advanced features. ```bash uv pip install "openmed[hf]" ``` -------------------------------- ### Run Full Test Suite Source: https://github.com/maziyarpanahi/openmed/blob/master/AGENTS.md Executes the complete test suite for the project to ensure code quality before submitting a Pull Request. ```bash .venv/bin/python -m pytest tests/ -q ``` -------------------------------- ### Run Tests Source: https://github.com/maziyarpanahi/openmed/blob/master/docs/onboarding.md Execute the full test suite or a scoped subset to confirm baseline passes before making changes. ```bash # Run the full test suite .venv/bin/python -m pytest tests/ -q # Or run a scoped subset (replace with the relevant test path) .venv/bin/python -m pytest tests/unit/test_pii.py -q ```