Testing george shakan tutorial
Browse files
app.py
CHANGED
@@ -3,9 +3,9 @@ from fastbook import load_learner
|
|
3 |
from fast.ai.vision.all import *
|
4 |
|
5 |
def predict(im):
|
6 |
-
im =
|
7 |
-
pred
|
8 |
-
return
|
9 |
|
10 |
labels = learn.dls.vocab
|
11 |
|
@@ -13,7 +13,7 @@ model = load_learner('./dr_model.pkl')
|
|
13 |
|
14 |
demo = gr.Interface(
|
15 |
fn=predict,
|
16 |
-
inputs=
|
17 |
-
outputs=
|
18 |
-
|
19 |
demo.launch()
|
|
|
3 |
from fast.ai.vision.all import *
|
4 |
|
5 |
def predict(im):
|
6 |
+
im = im.reshape(1, 28*28)/255.0
|
7 |
+
pred = model.predict(im)[0]
|
8 |
+
return int(pred)
|
9 |
|
10 |
labels = learn.dls.vocab
|
11 |
|
|
|
13 |
|
14 |
demo = gr.Interface(
|
15 |
fn=predict,
|
16 |
+
inputs="sketchpad",
|
17 |
+
outputs = "label")
|
18 |
+
|
19 |
demo.launch()
|