Spaces:
Runtime error
Runtime error
Update app.ipynb
Browse files
app.ipynb
CHANGED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from fastai.vision.all import*
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
|
6 |
+
learn = load_learner ('model.pkl')
|
7 |
+
categories = ('1','2','3','4','5')
|
8 |
+
|
9 |
+
def classify_image(img):
|
10 |
+
pred,idx,probs = learn.predict(img)
|
11 |
+
return dict(zip(categories,map(float,probs)))
|
12 |
+
|
13 |
+
image = gr.inputs.Image(shape=(192,192))
|
14 |
+
label = gr.outputs.Label()
|
15 |
+
|
16 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
17 |
+
intf.launch(inline=False)
|