Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,10 @@ with open('class_labels.json', 'r') as f:
|
|
| 10 |
class_labels = json.load(f)
|
| 11 |
|
| 12 |
def preprocess_image(image):
|
|
|
|
|
|
|
| 13 |
image = cv2.resize(image, (128,128)) # Model için kullandığımız boyuta getir
|
|
|
|
| 14 |
image = image.astype('float32') / 255.0 # Normalize et
|
| 15 |
return np.expand_dims(image, axis=0) # Batch boyutu ekle
|
| 16 |
|
|
|
|
| 10 |
class_labels = json.load(f)
|
| 11 |
|
| 12 |
def preprocess_image(image):
|
| 13 |
+
|
| 14 |
+
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR) # Veri okuma uyumsuzluğunu kaldırma
|
| 15 |
image = cv2.resize(image, (128,128)) # Model için kullandığımız boyuta getir
|
| 16 |
+
image = np.array(image, dtype=np.float32) # Numpy dizisine çevir
|
| 17 |
image = image.astype('float32') / 255.0 # Normalize et
|
| 18 |
return np.expand_dims(image, axis=0) # Batch boyutu ekle
|
| 19 |
|