ZELEFACK commited on
Commit
53ad9da
·
verified ·
1 Parent(s): 7850be6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  import tensorflow as tf
 
3
  from tensorflow.keras.utils import CustomObjectScope
4
  from tensorflow.keras.layers.experimental.preprocessing import RandomHeight
5
 
@@ -8,10 +9,11 @@ with CustomObjectScope({'RandomHeight': RandomHeight}):
8
 
9
  def classify_image(inp):
10
  # Convert to PIL Image if we have a numpy array
11
- if isinstance(image_array, np.ndarray):
12
- image = Image.fromarray(image_array)
 
13
  else:
14
- image = image_array
15
 
16
  # Resize image to 224x224
17
  image = image.resize((224, 224), Image.Resampling.LANCZOS)
 
1
  import gradio as gr
2
  import tensorflow as tf
3
+ import numpy as np
4
  from tensorflow.keras.utils import CustomObjectScope
5
  from tensorflow.keras.layers.experimental.preprocessing import RandomHeight
6
 
 
9
 
10
  def classify_image(inp):
11
  # Convert to PIL Image if we have a numpy array
12
+ image = None
13
+ if isinstance(inp, np.ndarray):
14
+ image = Image.fromarray(inp)
15
  else:
16
+ image = inp
17
 
18
  # Resize image to 224x224
19
  image = image.resize((224, 224), Image.Resampling.LANCZOS)