Spaces:
Sleeping
Sleeping
update app
Browse files
app.py
CHANGED
@@ -1,16 +1,14 @@
|
|
1 |
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
-
|
5 |
|
6 |
-
|
|
|
|
|
7 |
|
8 |
-
|
9 |
-
pred,idx,probs = learn_meander.predict(img)
|
10 |
-
return dict(zip(categories, map(float,probs)))
|
11 |
-
|
12 |
-
image = gr.inputs.Image(shape=(200,200))
|
13 |
label = gr.outputs.Label()
|
14 |
|
15 |
-
|
16 |
-
|
|
|
1 |
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
+
learn = load_learner('model.pkl')
|
5 |
|
6 |
+
def classify_img(img):
|
7 |
+
pred,idx,probs = learn.predict(img)
|
8 |
+
return str(pred + ", probability: " + str(round(torch.max(probs).item(), 4)) )
|
9 |
|
10 |
+
image = gr.inputs.Image(shape=(192, 192))
|
|
|
|
|
|
|
|
|
11 |
label = gr.outputs.Label()
|
12 |
|
13 |
+
intf = gr.Interface(fn=classify_img, inputs=image, outputs=label)
|
14 |
+
intf.launch(inline=False)
|