File size: 357 Bytes
1eea96a
 
 
 
 
 
 
 
 
 
 
 
 
af94545
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr
import tensorflow as tf

model = tf.keras.models.load_model("model.h5")


def sketch_recognition(img):
    img = img.reshape(1, 28, 28, 1).astype('float32') / 255
    prediction = model.predict(img)
    return int(tf.argmax(prediction, 1))


gr.Interface(fn=sketch_recognition, inputs="sketchpad",
             outputs="label").launch()