Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import numpy as np
|
| 3 |
+
from keras.models import load_model
|
| 4 |
+
|
| 5 |
+
model = load_model("QuickDraw_model.h5")
|
| 6 |
+
|
| 7 |
+
def QuickDraw(arr):
|
| 8 |
+
arr = arr.reshape((1,28,28,1))
|
| 9 |
+
output = model(arr)
|
| 10 |
+
labels = ["Apple","Cell Phone","Chair","Hot Air Balloon","Jail","Ladder","Line","Spider","Windmill","Zigzag"]
|
| 11 |
+
return {labels[idx]: float(val) for idx, val in enumerate(output[0])}
|
| 12 |
+
|
| 13 |
+
iface = gr.Interface(fn=QuickDraw, inputs="sketchpad", outputs="label")
|
| 14 |
+
iface.launch()
|