Dev Gaykar commited on
Commit ·
8849efa
1
Parent(s): 06bcad3
initial commit
Browse files- app.py +19 -0
- export.pkl +3 -0
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
def ice_cream(x): return x[0].isupper()
|
| 5 |
+
|
| 6 |
+
learn = load_learner('export.pkl')
|
| 7 |
+
|
| 8 |
+
categories = ('choco chip', 'classical chocolate','mint chocolate')
|
| 9 |
+
|
| 10 |
+
def classify_image(img):
|
| 11 |
+
pred,idx,probs = learn.predict(img)
|
| 12 |
+
return dict(zip(categories,map(float,probs)))
|
| 13 |
+
|
| 14 |
+
image = gr.Image(width=192,height=192)
|
| 15 |
+
label = gr.Label()
|
| 16 |
+
examples = ['images/img1.png','images/img2.png','images/image.png']
|
| 17 |
+
|
| 18 |
+
intf = gr.Interface(fn=classify_image,inputs=image,outputs=label,examples=examples)
|
| 19 |
+
intf.launch(inline=False)
|
export.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1918a6f0dea2b86bed4ec397cb5915da7dff3f2696606035c69a603cdd5a91f5
|
| 3 |
+
size 46978302
|