sparrow8i8 commited on
Commit
236485f
·
1 Parent(s): 1af5881

added details

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -1,7 +1,21 @@
1
  import gradio as gr
 
 
2
 
3
- def greet (name):
4
- return 'hi {name}'
 
 
 
 
 
 
 
 
 
 
 
 
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