Spaces:
Sleeping
Sleeping
Update src/ai_processor.py
Browse files- src/ai_processor.py +3 -9
src/ai_processor.py
CHANGED
|
@@ -16,7 +16,7 @@ import cv2
|
|
| 16 |
import numpy as np
|
| 17 |
from PIL import Image
|
| 18 |
from PIL.ExifTags import TAGS
|
| 19 |
-
|
| 20 |
# --- Logging config ---
|
| 21 |
logging.basicConfig(
|
| 22 |
level=getattr(logging, LOGLEVEL, logging.INFO),
|
|
@@ -26,12 +26,6 @@ logging.basicConfig(
|
|
| 26 |
def _log_kv(prefix: str, kv: Dict):
|
| 27 |
logging.debug(prefix + " | " + " | ".join(f"{k}={v}" for k, v in kv.items()))
|
| 28 |
|
| 29 |
-
# --- Spaces GPU decorator (REQUIRED) ---
|
| 30 |
-
from spaces import GPU as _SPACES_GPU
|
| 31 |
-
|
| 32 |
-
@_SPACES_GPU(enable_queue=True)
|
| 33 |
-
def smartheal_gpu_stub(ping: int = 0) -> str:
|
| 34 |
-
return "ready"
|
| 35 |
|
| 36 |
# ---- Paths / constants ----
|
| 37 |
UPLOADS_DIR = "uploads"
|
|
@@ -918,7 +912,7 @@ Automated analysis provides quantitative measurements; verify via clinical exami
|
|
| 918 |
logging.error(f"Failed to save/commit image: {e}")
|
| 919 |
return ""
|
| 920 |
|
| 921 |
-
@
|
| 922 |
def full_analysis_pipeline(self, image_pil: Image.Image, questionnaire_data: Dict) -> Dict:
|
| 923 |
try:
|
| 924 |
saved_path = self.save_and_commit_image(image_pil)
|
|
@@ -964,7 +958,7 @@ Automated analysis provides quantitative measurements; verify via clinical exami
|
|
| 964 |
"saved_image_path": None,
|
| 965 |
"guideline_context": "",
|
| 966 |
}
|
| 967 |
-
@
|
| 968 |
def analyze_wound(self, image, questionnaire_data: Dict) -> Dict:
|
| 969 |
try:
|
| 970 |
if isinstance(image, str):
|
|
|
|
| 16 |
import numpy as np
|
| 17 |
from PIL import Image
|
| 18 |
from PIL.ExifTags import TAGS
|
| 19 |
+
import spaces
|
| 20 |
# --- Logging config ---
|
| 21 |
logging.basicConfig(
|
| 22 |
level=getattr(logging, LOGLEVEL, logging.INFO),
|
|
|
|
| 26 |
def _log_kv(prefix: str, kv: Dict):
|
| 27 |
logging.debug(prefix + " | " + " | ".join(f"{k}={v}" for k, v in kv.items()))
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
# ---- Paths / constants ----
|
| 31 |
UPLOADS_DIR = "uploads"
|
|
|
|
| 912 |
logging.error(f"Failed to save/commit image: {e}")
|
| 913 |
return ""
|
| 914 |
|
| 915 |
+
@spaces.GPU
|
| 916 |
def full_analysis_pipeline(self, image_pil: Image.Image, questionnaire_data: Dict) -> Dict:
|
| 917 |
try:
|
| 918 |
saved_path = self.save_and_commit_image(image_pil)
|
|
|
|
| 958 |
"saved_image_path": None,
|
| 959 |
"guideline_context": "",
|
| 960 |
}
|
| 961 |
+
@spaces.GPU
|
| 962 |
def analyze_wound(self, image, questionnaire_data: Dict) -> Dict:
|
| 963 |
try:
|
| 964 |
if isinstance(image, str):
|