--- title: Card & Letterhead OCR Extractor emoji: 🪪 colorFrom: red colorTo: green sdk: gradio app_file: app.py app_port: 7860 pinned: false --- # Visiting Card & Letterhead OCR Extractor Extracts structured contact data from visiting cards and letter headers/footers using a two-step NVIDIA AI pipeline: **nemoretriever-ocr-v1** → raw text → **nvidia-nemotron-nano-9b-v2** → structured JSON ## Extracted Fields | Field | Description | |---|---| | Company Name | Firm / organisation name | | Contact Person | Individual's name | | Designation | Job title / role | | Mobile | Mobile number(s) | | Phone | Landline / office number(s) | | Email | Email address(es) | | Address | Full postal address | | PIN | PIN / ZIP / postal code | | City / State / Country | Location breakdown | | GST Number | 15-char GSTIN | | Website | URL | | Fax | Fax number | ## Files in this Space | File | Purpose | |---|---| | `app.py` | FastAPI app — OCR pipeline + serves `index.html` at `/` | | `index.html` | Frontend UI (drop / paste / browse images) | | `requirements.txt` | Python dependencies | | `README.md` | This file | > **No Dockerfile needed** — HF Spaces handles the container automatically with `sdk: gradio`. ## Setup on Hugging Face Spaces 1. Create a new Space → SDK: **Gradio** 2. Upload: `app.py`, `index.html`, `requirements.txt`, `README.md` 3. Go to **Settings → Variables and secrets** → add secret: - Name: `NVIDIA_API_KEY` - Value: your `nvapi-...` key from [build.nvidia.com](https://build.nvidia.com) 4. Space builds automatically. The UI appears at your Space URL. ## Local Usage ```bash pip install fastapi uvicorn requests python-multipart pydantic export NVIDIA_API_KEY=nvapi-YOUR_KEY_HERE python app.py # Open http://localhost:7860 ``` ## How to Use the UI - **Click** the drop zone to browse files - **Drag & drop** an image onto the drop zone - **Paste** (`Ctrl+V` / `⌘V`) a screenshot or copied image — no file needed! - Switch to **Batch mode** to process up to 10 cards at once - Use **Copy JSON** or **Copy CSV row** to export results