Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
-
from PIL import Image
|
| 4 |
-
from matplotlib import cm
|
| 5 |
from keras.models import load_model
|
| 6 |
|
| 7 |
model = load_model("QuickDraw_model.h5")
|
|
@@ -12,5 +10,15 @@ def QuickDraw(arr):
|
|
| 12 |
labels = ["Apple","Cell Phone","Chair","Hot Air Balloon","Jail","Ladder","Line","Spider","Windmill","Zigzag"]
|
| 13 |
return {labels[idx]: float(val) for idx, val in enumerate(output[0])}
|
| 14 |
|
| 15 |
-
iface = gr.Interface(fn=QuickDraw,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
iface.launch()
|
|
|
|
| 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")
|
|
|
|
| 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,
|
| 14 |
+
inputs=gr.Image(source="canvas",
|
| 15 |
+
tool="sketch",
|
| 16 |
+
brush_radius=0.7,
|
| 17 |
+
invert_colors=True,
|
| 18 |
+
heigt=400,
|
| 19 |
+
width=400,
|
| 20 |
+
shape=(28,28),
|
| 21 |
+
image_mode="L",
|
| 22 |
+
interactive=True),
|
| 23 |
+
outputs="label")
|
| 24 |
iface.launch()
|