Pavan Kishore Arava commited on
Commit
781a1c6
·
1 Parent(s): 019d868

flower classifier initial commit

Browse files
Files changed (5) hide show
  1. app.py +18 -0
  2. flowersclassifier.pkl +3 -0
  3. marigold.jpg +0 -0
  4. requirements.txt +1 -0
  5. sunflower.jpg +0 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+ learn = load_learner('flowersclassifier.pkl')
5
+ labels = learn.dls.vocab
6
+ def predict(img):
7
+ img = PILImage.create(img)
8
+ pred,pred_idx,probs = learn.predict(img)
9
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
10
+
11
+ title = "Flower Classifier"
12
+ description = "A flower classifier trained on the images downloaded from the internet."
13
+ examples = ['sunflower.jpg','marigold.jpg']
14
+ interpretation='default'
15
+ enable_queue=True
16
+
17
+ intf = gr.Interface(fn=predict,inputs=gr.Image(type="pil"),outputs=gr.Label(),title=title,description=description,examples=examples,interpretation=interpretation,enable_queue=enable_queue)
18
+ intf.launch()
flowersclassifier.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad91a31a33b19439553855abe982710a1fac36cca0f2a40f577fddd0baac1096
3
+ size 46985022
marigold.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai
sunflower.jpg ADDED