MedMagik commited on
Commit
848667c
·
verified ·
1 Parent(s): 87b14cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -5,6 +5,7 @@ import gradio as gr
5
  from tensorflow.keras.preprocessing.image import load_img, img_to_array
6
  from tensorflow.keras.applications.densenet import preprocess_input, decode_predictions
7
  import numpy as np
 
8
  from PIL import Image
9
  import matplotlib.pyplot as plt
10
  model = load_model('Densenet.h5')
@@ -64,6 +65,11 @@ def classify_image(img):
64
  mean = np.mean(img_array, axis=(0, 1))
65
  std = np.std(img_array, axis=(0, 1))
66
  img_array = (img_array - mean) / std
 
 
 
 
 
67
 
68
 
69
  predictions1 = model.predict(img_array)
 
5
  from tensorflow.keras.preprocessing.image import load_img, img_to_array
6
  from tensorflow.keras.applications.densenet import preprocess_input, decode_predictions
7
  import numpy as np
8
+ from scipy import ndimage
9
  from PIL import Image
10
  import matplotlib.pyplot as plt
11
  model = load_model('Densenet.h5')
 
65
  mean = np.mean(img_array, axis=(0, 1))
66
  std = np.std(img_array, axis=(0, 1))
67
  img_array = (img_array - mean) / std
68
+ zoom_factor = 1.2 # 20% zoom
69
+ img_array = ndimage.zoom(img_array, zoom_factor)
70
+
71
+ # Crop the zoomed image to maintain the original size
72
+ zoomed_img = zoomed_img[:224, :224, :]
73
 
74
 
75
  predictions1 = model.predict(img_array)