ar07xd commited on
Commit
c9b7b2b
·
verified ·
1 Parent(s): 6a4e518

Sync from GitHub via hub-sync

Browse files
Dockerfile CHANGED
@@ -7,7 +7,6 @@ ENV PYTHONDONTWRITEBYTECODE=1
7
 
8
  # Tell HuggingFace where to cache downloaded models (ViT, BERT)
9
  ENV HF_HOME=/app/.cache/huggingface
10
- ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
11
 
12
  # Set working directory
13
  WORKDIR /app
 
7
 
8
  # Tell HuggingFace where to cache downloaded models (ViT, BERT)
9
  ENV HF_HOME=/app/.cache/huggingface
 
10
 
11
  # Set working directory
12
  WORKDIR /app
requirements.txt CHANGED
@@ -31,7 +31,7 @@ mediapipe==0.10.14
31
 
32
  # === Phase 12: Explainability v2 ===
33
  exifread==3.0.0
34
- google-generativeai>=0.3.0 # Gemini provider for LLM explainability
35
  openai>=1.0.0 # OpenAI provider (alternative to Gemini)
36
 
37
  # === Phase 14: PDF v2 donut chart ===
@@ -55,6 +55,8 @@ xhtml2pdf==0.2.16
55
 
56
  # === Phase 8: Auth ===
57
  email-validator==2.2.0
 
 
58
 
59
  # === Phase 15: Security Hardening ===
60
  slowapi==0.1.9
 
31
 
32
  # === Phase 12: Explainability v2 ===
33
  exifread==3.0.0
34
+ google-genai>=0.1.0 # New Gemini SDK (replaces google-generativeai)
35
  openai>=1.0.0 # OpenAI provider (alternative to Gemini)
36
 
37
  # === Phase 14: PDF v2 donut chart ===
 
55
 
56
  # === Phase 8: Auth ===
57
  email-validator==2.2.0
58
+ reportlab==4.2.5 # Fallback PDF generation
59
+ scikit-learn>=1.5.0 # Required for Isotonic Calibrator in EfficientNet
60
 
61
  # === Phase 15: Security Hardening ===
62
  slowapi==0.1.9
schemas/common.py CHANGED
@@ -61,6 +61,8 @@ class ExifSummary(BaseModel):
61
 
62
 
63
  class LLMExplainabilitySummary(BaseModel):
 
 
64
  paragraph: str = ""
65
  bullets: List[str] = []
66
  model_used: str = ""
@@ -73,6 +75,8 @@ class VLMComponentScore(BaseModel):
73
 
74
 
75
  class VLMBreakdown(BaseModel):
 
 
76
  facial_symmetry: VLMComponentScore = VLMComponentScore()
77
  skin_texture: VLMComponentScore = VLMComponentScore()
78
  lighting_consistency: VLMComponentScore = VLMComponentScore()
 
61
 
62
 
63
  class LLMExplainabilitySummary(BaseModel):
64
+ model_config = ConfigDict(protected_namespaces=())
65
+
66
  paragraph: str = ""
67
  bullets: List[str] = []
68
  model_used: str = ""
 
75
 
76
 
77
  class VLMBreakdown(BaseModel):
78
+ model_config = ConfigDict(protected_namespaces=())
79
+
80
  facial_symmetry: VLMComponentScore = VLMComponentScore()
81
  skin_texture: VLMComponentScore = VLMComponentScore()
82
  lighting_consistency: VLMComponentScore = VLMComponentScore()
services/efficientnet_service.py CHANGED
@@ -22,10 +22,8 @@ if str(_ICPR_ROOT) not in sys.path:
22
  if _NOTEBOOK_DIR not in sys.path:
23
  sys.path.insert(0, _NOTEBOOK_DIR)
24
 
25
- # These imports are valid only after the sys.path patch above.
26
- from blazeface import BlazeFace, FaceExtractor # noqa: E402
27
- from architectures import fornet, weights # noqa: E402
28
- from isplutils import utils as ispl_utils # noqa: E402
29
 
30
  # Default calibrator path — populated by scripts/fit_calibrator.py.
31
  _CALIBRATOR_PATH = Path(__file__).resolve().parent.parent / "models" / "efficientnet_calibrator.pkl"
@@ -61,6 +59,11 @@ class EfficientNetDetector:
61
  device: str = "cpu",
62
  calibrator_path: Optional[Path] = None,
63
  ) -> None:
 
 
 
 
 
64
  self.device = torch.device(device)
65
  self.model_name = model_name
66
  self.train_db = train_db
 
22
  if _NOTEBOOK_DIR not in sys.path:
23
  sys.path.insert(0, _NOTEBOOK_DIR)
24
 
25
+ # These imports must be handled carefully as they rely on the sys.path patch above.
26
+ # We move them inside the class or use dynamic imports to ensure stability on HF.
 
 
27
 
28
  # Default calibrator path — populated by scripts/fit_calibrator.py.
29
  _CALIBRATOR_PATH = Path(__file__).resolve().parent.parent / "models" / "efficientnet_calibrator.pkl"
 
59
  device: str = "cpu",
60
  calibrator_path: Optional[Path] = None,
61
  ) -> None:
62
+ # Dynamic imports to ensure sys.path patching is active
63
+ from blazeface import BlazeFace, FaceExtractor
64
+ from architectures import fornet, weights
65
+ from isplutils import utils as ispl_utils
66
+
67
  self.device = torch.device(device)
68
  self.model_name = model_name
69
  self.train_db = train_db