Spaces:
Sleeping
Sleeping
Commit
·
b84d1c2
1
Parent(s):
c6ecab7
Remove OpenCV dependency entirely, replace with PIL for image resizing
Browse files- Dockerfile +0 -3
- app.py +0 -1
- requirements.txt +0 -1
- src/explain.py +1 -1
Dockerfile
CHANGED
|
@@ -11,9 +11,6 @@ ENV PYTHONPATH="/app"
|
|
| 11 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 12 |
ENV PYTHONUNBUFFERED=1
|
| 13 |
ENV MPLCONFIGDIR=/app/matplotlib_cache
|
| 14 |
-
ENV QT_QPA_PLATFORM=offscreen
|
| 15 |
-
ENV OPENCV_IO_ENABLE_JASPER=0
|
| 16 |
-
ENV OPENCV_IO_ENABLE_OPENEXR=0
|
| 17 |
|
| 18 |
# Install minimal system dependencies for headless OpenCV
|
| 19 |
RUN apt-get update && apt-get install -y \
|
|
|
|
| 11 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 12 |
ENV PYTHONUNBUFFERED=1
|
| 13 |
ENV MPLCONFIGDIR=/app/matplotlib_cache
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Install minimal system dependencies for headless OpenCV
|
| 16 |
RUN apt-get update && apt-get install -y \
|
app.py
CHANGED
|
@@ -26,7 +26,6 @@ import matplotlib
|
|
| 26 |
matplotlib.use('Agg')
|
| 27 |
import matplotlib.pyplot as plt
|
| 28 |
|
| 29 |
-
import cv2
|
| 30 |
import base64
|
| 31 |
from datetime import datetime
|
| 32 |
import time
|
|
|
|
| 26 |
matplotlib.use('Agg')
|
| 27 |
import matplotlib.pyplot as plt
|
| 28 |
|
|
|
|
| 29 |
import base64
|
| 30 |
from datetime import datetime
|
| 31 |
import time
|
requirements.txt
CHANGED
|
@@ -11,7 +11,6 @@ uvicorn[standard]
|
|
| 11 |
python-multipart
|
| 12 |
# Image processing
|
| 13 |
Pillow
|
| 14 |
-
opencv-python-headless==4.8.1.78
|
| 15 |
# Grad-CAM visualization
|
| 16 |
grad-cam
|
| 17 |
|
|
|
|
| 11 |
python-multipart
|
| 12 |
# Image processing
|
| 13 |
Pillow
|
|
|
|
| 14 |
# Grad-CAM visualization
|
| 15 |
grad-cam
|
| 16 |
|
src/explain.py
CHANGED
|
@@ -134,7 +134,7 @@ class CropDiseaseExplainer:
|
|
| 134 |
# Generate Grad-CAM
|
| 135 |
try:
|
| 136 |
# Resize original image for overlay
|
| 137 |
-
original_resized =
|
| 138 |
original_resized = original_resized / 255.0
|
| 139 |
|
| 140 |
print(f"Input tensor shape: {input_tensor.shape}")
|
|
|
|
| 134 |
# Generate Grad-CAM
|
| 135 |
try:
|
| 136 |
# Resize original image for overlay
|
| 137 |
+
original_resized = np.array(original_image.resize((224, 224)))
|
| 138 |
original_resized = original_resized / 255.0
|
| 139 |
|
| 140 |
print(f"Input tensor shape: {input_tensor.shape}")
|