zhawszenthen commited on
Commit
5c4a90a
1 Parent(s): 357e4b2
Files changed (1) hide show
  1. app.py +1 -1
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) / 127.5 - 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
 
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