RyanDA's picture
Update app.py
8fc61fc
raw
history blame contribute delete
940 Bytes
import gradio as gr
import numpy as np
from keras.models import load_model
model = load_model("QuickDraw_model.h5")
def QuickDraw(arr):
arr = arr.reshape((1,28,28,1))
output = model(arr)
labels = ["Apple","Cell Phone","Chair","Hot Air Balloon","Jail","Ladder","Line","Spider","Windmill","Zigzag"]
return {labels[idx]: float(val) for idx, val in enumerate(output[0])}
iface = gr.Interface(fn=QuickDraw,
inputs=gr.Image(source="canvas",
tool="sketch",
brush_radius=0.7,
invert_colors=True,
heigt=400,
width=400,
shape=(28,28),
image_mode="L",
interactive=True),
outputs="label")
iface.launch()