|
|
""" |
|
|
Configuration file for Fish Disease Detection System |
|
|
Secure deployment with environment variables |
|
|
""" |
|
|
|
|
|
import os |
|
|
import torch |
|
|
|
|
|
|
|
|
CLASSES = [ |
|
|
'Aeromoniasis', |
|
|
'Bacterial_gill_disease', |
|
|
'Bacterial_red_disease', |
|
|
'EUS', |
|
|
'Healthy_Fish', |
|
|
'Parasitic_diseases', |
|
|
'Saprolegniasis_fungal', |
|
|
'Viral_white_tail' |
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
GEMINI_API_KEY = os.environ.get('GEMINI_API_KEY') |
|
|
GEMINI_MODEL_NAME = os.environ.get('GEMINI_MODEL_NAME', 'gemini-2.0-flash-exp') |
|
|
|
|
|
|
|
|
if not GEMINI_API_KEY: |
|
|
print("β οΈ WARNING: GEMINI_API_KEY not found in environment variables!") |
|
|
print(" Set it in .env file (local) or Hugging Face Space settings (production)") |
|
|
print(" Gemini AI features will be disabled.") |
|
|
|
|
|
|
|
|
MODEL_PATH = 'models/vgg_resnet/results/vgg_resnet/vgg16_best.pth' |
|
|
CONFIDENCE_THRESHOLD = 70.0 |
|
|
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu' |
|
|
|
|
|
|
|
|
MAX_FILE_SIZE_MB = 10 |
|
|
MIN_IMAGE_SIZE_PX = 100 |
|
|
VALID_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.JPG', '.JPEG', '.PNG'] |
|
|
|
|
|
|
|
|
IMAGE_SIZE = 224 |
|
|
NORMALIZE_MEAN = [0.485, 0.456, 0.406] |
|
|
NORMALIZE_STD = [0.229, 0.224, 0.225] |
|
|
|
|
|
|
|
|
DEBUG = os.environ.get('DEBUG', 'False').lower() == 'true' |
|
|
|
|
|
if DEBUG: |
|
|
print("="*60) |
|
|
print("π Fish Disease Detection - Configuration") |
|
|
print("="*60) |
|
|
print(f" Model Path: {MODEL_PATH}") |
|
|
print(f" Device: {DEVICE}") |
|
|
print(f" Classes: {len(CLASSES)}") |
|
|
print(f" Confidence Threshold: {CONFIDENCE_THRESHOLD}%") |
|
|
print(f" Gemini API Key: {'β
Set' if GEMINI_API_KEY else 'β Not Set'}") |
|
|
print(f" Gemini Model: {GEMINI_MODEL_NAME if GEMINI_API_KEY else 'N/A'}") |
|
|
print("="*60) |
|
|
|