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