File size: 1,176 Bytes
1b8dcf1 060dc2a 1b8dcf1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
"""
Configuration settings for Invoice Information Extractor API
"""
import os
from pathlib import Path
# Base directories
BASE_DIR = Path(__file__).resolve().parent
MODELS_DIR = BASE_DIR / "utils" / "models"
# Model paths
YOLO_MODEL_PATH = MODELS_DIR / "best.pt"
# VLM Model Configuration
VLM_MODEL_ID = "Qwen/Qwen2.5-VL-7B-Instruct"
# Quantization settings
QUANTIZATION_CONFIG = {
"load_in_4bit": True,
"bnb_4bit_quant_type": "nf4",
"bnb_4bit_compute_dtype": "float16",
"bnb_4bit_use_double_quant": True
}
# Image processing settings
MAX_IMAGE_SIZE = 800 # Maximum dimension for resizing
# Detection thresholds
YOLO_CONFIDENCE_THRESHOLD = 0.25
# Validation ranges
HP_VALID_RANGE = (20, 120)
ASSET_COST_VALID_RANGE = (100_000, 3_000_000)
# Cost calculation
COST_PER_GPU_HOUR = 0.6 # USD
# API settings
API_TITLE = "Invoice Information Extractor API"
API_DESCRIPTION = """
Extract structured information from Indian tractor invoices using AI.
**Features:**
- Extracts dealer name, model name, horse power, and asset cost
- Detects signatures and stamps with bounding boxes
- Provides confidence scores and cost estimates
"""
API_VERSION = "1.0.0"
|