Spaces:
Sleeping
Sleeping
Commit
·
236485f
1
Parent(s):
1af5881
added details
Browse files
app.py
CHANGED
@@ -1,7 +1,21 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
iface=gr.Interface(fn=greet,inputs="text",outputs="text")
|
7 |
|
|
|
1 |
import gradio as gr
|
2 |
+
import fastai
|
3 |
+
from fastai.vision.all import *
|
4 |
|
5 |
+
learn=load_learner('export.pkl')
|
6 |
+
|
7 |
+
categories=('not psilocybe','psilocybe')
|
8 |
+
|
9 |
+
def classify(img):
|
10 |
+
pred,idx,probs=learn.predict(img)
|
11 |
+
return dict(zip(categories, map(float,probs)))
|
12 |
+
|
13 |
+
|
14 |
+
image = gr.inputs.Image(shape = (192,192))
|
15 |
+
label= gr.outputs.Label()
|
16 |
+
examples=['psilocybe.jpg']
|
17 |
+
intf=gr.Interface(fn=classify,inputs=image,outputs=label,example=examples)
|
18 |
+
intf.launch(inline=False)
|
19 |
|
20 |
iface=gr.Interface(fn=greet,inputs="text",outputs="text")
|
21 |
|