Spaces:
Running
Running
Update src/ai_processor.py
Browse files- src/ai_processor.py +5 -1
src/ai_processor.py
CHANGED
|
@@ -212,9 +212,13 @@ def load_yolo_model():
|
|
| 212 |
|
| 213 |
def load_segmentation_model(SEG_MODEL_PATH):
|
| 214 |
"""Lazy import and load segmentation model."""
|
| 215 |
-
|
|
|
|
|
|
|
|
|
|
| 216 |
return load_model(SEG_MODEL_PATH, compile=False)
|
| 217 |
|
|
|
|
| 218 |
def load_classification_pipeline():
|
| 219 |
pipe = _import_hf_cls()
|
| 220 |
return pipe("image-classification", model="Hemg/Wound-classification", token=HF_TOKEN, device="cpu")
|
|
|
|
| 212 |
|
| 213 |
def load_segmentation_model(SEG_MODEL_PATH):
|
| 214 |
"""Lazy import and load segmentation model."""
|
| 215 |
+
# Use the lazy loader to ensure TF is imported correctly
|
| 216 |
+
load_model = _import_tf_loader()
|
| 217 |
+
# The compile=False argument is crucial for avoiding optimizer/loss issues
|
| 218 |
+
# and can sometimes help with layer deserialization.
|
| 219 |
return load_model(SEG_MODEL_PATH, compile=False)
|
| 220 |
|
| 221 |
+
|
| 222 |
def load_classification_pipeline():
|
| 223 |
pipe = _import_hf_cls()
|
| 224 |
return pipe("image-classification", model="Hemg/Wound-classification", token=HF_TOKEN, device="cpu")
|