Spaces:
Runtime error
Runtime error
File size: 682 Bytes
7edb3e4 999fa11 7edb3e4 e899f0f 7edb3e4 999fa11 e899f0f 999fa11 e634e4c e899f0f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
import tensorflow as tf
model = tf.keras.models.load_model("saved_model.pb")
def mnist_classifier(img):
# Convert the image input to a tensor
img_tensor = tf.convert_to_tensor(img['composite'], dtype=tf.float32)
img_tensor = tf.image.resize(img_tensor, [28, 28])
# Normalize and expand to add the batch dimension
img_tensor /= 255.0
img_tensor = tf.expand_dims(img_tensor, 0)
#prediction = model.predict(img_tensor)
return "Hi"
demo = gr.Interface(fn=mnist_classifier, inputs="sketchpad", outputs="text", title="MNIST Checker", description="Draw a number 0-9 to see if the model can classify it.")
demo.launch(share=True) |