Spaces:
Sleeping
Sleeping
Update app/services/segmenter.py
Browse files
app/services/segmenter.py
CHANGED
|
@@ -1,4 +1,9 @@
|
|
| 1 |
# app/services/segmenter.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import numpy as np
|
| 3 |
import tensorflow as tf
|
| 4 |
from typing import Dict, Any
|
|
@@ -23,7 +28,7 @@ def segment_image(image_bytes: bytes) -> Dict[str, Any]:
|
|
| 23 |
}
|
| 24 |
|
| 25 |
try:
|
| 26 |
-
# Preprocess for segmentation (256x256)
|
| 27 |
img_array = preprocess_image(image_bytes, target_size=(256, 256))
|
| 28 |
|
| 29 |
# 🔥 Call SavedModel signature
|
|
|
|
| 1 |
# app/services/segmenter.py
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
# 🔥 تعطيل oneDNN لتجنب أخطاء conv2d_transpose
|
| 5 |
+
os.environ["TF_ENABLE_ONEDNN_OPTS"] = "0"
|
| 6 |
+
|
| 7 |
import numpy as np
|
| 8 |
import tensorflow as tf
|
| 9 |
from typing import Dict, Any
|
|
|
|
| 28 |
}
|
| 29 |
|
| 30 |
try:
|
| 31 |
+
# 🔥 Preprocess for segmentation (256x256)
|
| 32 |
img_array = preprocess_image(image_bytes, target_size=(256, 256))
|
| 33 |
|
| 34 |
# 🔥 Call SavedModel signature
|