Spaces:
Sleeping
Sleeping
zhawszenthen
commited on
Commit
•
5c4a90a
1
Parent(s):
357e4b2
push
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ labels = ['glioma_tumor', 'meningioma_tumor', 'no_tumor', 'pituitary_tumor']
|
|
14 |
def preprocess_image(image):
|
15 |
image = Image.fromarray(image.astype('uint8')) # Konvertierung des Numpy-Arrays in ein PIL-Bild
|
16 |
image = image.resize((224, 224)) # Bildgröße anpassen auf 224x224 Pixel
|
17 |
-
image = np.array(image) /
|
18 |
|
19 |
# Sicherstellen, dass das Bild 3 Farbkanäle hat
|
20 |
if image.ndim == 2: # Wenn das Bild grau ist, in RGB konvertieren
|
|
|
14 |
def preprocess_image(image):
|
15 |
image = Image.fromarray(image.astype('uint8')) # Konvertierung des Numpy-Arrays in ein PIL-Bild
|
16 |
image = image.resize((224, 224)) # Bildgröße anpassen auf 224x224 Pixel
|
17 |
+
image = np.array(image) / 255 - 1.0 # In Float konvertieren und normalisieren auf [-1, 1]
|
18 |
|
19 |
# Sicherstellen, dass das Bild 3 Farbkanäle hat
|
20 |
if image.ndim == 2: # Wenn das Bild grau ist, in RGB konvertieren
|