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