Aharneish commited on
Commit
72b2f0e
1 Parent(s): 79aafd3
Files changed (7) hide show
  1. app.py +11 -5
  2. class.pkl +3 -0
  3. lilly.jpg +0 -0
  4. lotus.jpg +0 -0
  5. orchid.jpg +0 -0
  6. sunflower.jpg +0 -0
  7. tulip.jpg +0 -0
app.py CHANGED
@@ -1,7 +1,13 @@
1
  import gradio as gr
 
 
 
 
 
 
 
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
-
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
1
  import gradio as gr
2
+ from fastai.vision.all import *
3
+ learn=load_learner("class.pkl")
4
+ categories=('Lilly','Lotus','Orchid','Sunflower','Tulip')
5
+ def classify_image(img):
6
+ pred,idx,probs=learn.predict(img)
7
+ return dict(zip(categories,map(float,probs)))
8
+ image=gr.inputs.Image(shape=192,192)
9
+ label=gr.outputs.Label()
10
+ examples=['lilly.jpg','lotus.jpg','orchid.jpg','sunflower.jpg','tulip.jpg']
11
 
12
+ intf=gr.Interface(fn=classify_image,inputs=image,outputs=label,examples=examples)
13
+ intf.launch(inline=False)
 
 
 
class.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c050915e2b9c5fb9da0bdd24b3d534d1ab623da212154cb4d55b936e702f880b
3
+ size 102981753
lilly.jpg ADDED
lotus.jpg ADDED
orchid.jpg ADDED
sunflower.jpg ADDED
tulip.jpg ADDED