Ibrahim Animashaun commited on
Commit
434690d
1 Parent(s): 458792b

Add preprocess_input for resnet50

Browse files
Files changed (3) hide show
  1. .DS_Store +0 -0
  2. app.py +2 -0
  3. data/.DS_Store +0 -0
.DS_Store ADDED
Binary file (6.15 kB). View file
 
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  import pathlib
 
3
 
4
  current_dir = pathlib.Path(__file__).parent
5
 
@@ -68,6 +69,7 @@ def classify_image(inp):
68
  inp =resize(inp, (300, 300, 3))
69
  inp = inp.reshape((-1, 300, 300, 3))
70
  # inp = tf.keras.applications.mobilenet_v2.preprocess_input(inp)
 
71
  prediction = oc_resnet50_model2.predict(inp).flatten()
72
  confidences = {labels[i]: float(prediction[i]) for i in range(2)}
73
  return confidences
 
1
  import gradio as gr
2
  import pathlib
3
+ import tensorflow as tf
4
 
5
  current_dir = pathlib.Path(__file__).parent
6
 
 
69
  inp =resize(inp, (300, 300, 3))
70
  inp = inp.reshape((-1, 300, 300, 3))
71
  # inp = tf.keras.applications.mobilenet_v2.preprocess_input(inp)
72
+ inp = tf.keras.applications.resnet50.preprocess_input(inp)
73
  prediction = oc_resnet50_model2.predict(inp).flatten()
74
  confidences = {labels[i]: float(prediction[i]) for i in range(2)}
75
  return confidences
data/.DS_Store ADDED
Binary file (6.15 kB). View file