Jorge Fioranelli commited on
Commit
839e6e2
1 Parent(s): e04d583

Added numpy

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import gradio as gr
 
2
  import tensorflow as tf
3
  import urllib.request
4
 
@@ -14,7 +15,7 @@ labels = labels.decode('utf-8').split("\n")[:-1]
14
 
15
  def predict(img):
16
  img = tf.math.divide(img, 255)
17
- preds = cnn_model.predict(img.reshape(-1, 28, 28, 1))[0]
18
  return {label: float(pred) for label, pred in zip(labels, preds)}
19
 
20
  output = gr.outputs.Label(num_top_classes=3)
 
1
  import gradio as gr
2
+ import numpy as np
3
  import tensorflow as tf
4
  import urllib.request
5
 
 
15
 
16
  def predict(img):
17
  img = tf.math.divide(img, 255)
18
+ preds = cnn_model.predict(img.numpy().reshape(-1, 28, 28, 1))[0]
19
  return {label: float(pred) for label, pred in zip(labels, preds)}
20
 
21
  output = gr.outputs.Label(num_top_classes=3)