satish860 commited on
Commit
2995784
·
1 Parent(s): d4e6386

My initial check-in

Browse files
.ipynb_checkpoints/README-checkpoint.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Food Classifier
3
+ emoji: 🐢
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: gradio
7
+ sdk_version: 3.1.4
8
+ app_file: app.py
9
+ pinned: false
10
+ license: apache-2.0
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
.ipynb_checkpoints/app-checkpoint.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ learn = load_learner('export.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 = "Food 101 Classifier"
12
+ description = "A Food 101 Classifier created using Custom Dataset from Kaggle. Created as a demo for Gradio and HuggingFace Spaces."
13
+ article="<p style='text-align: center'><a href='https://satish1v.medium.com/' target='_blank'>Blog post coming soon</a></p>"
14
+ enable_queue=True
15
+ examples = ['1005649.jpg']
16
+
17
+
18
+ demo=gr.Interface(fn=predict,
19
+ inputs=gr.inputs.Image(shape=(460, 460)),
20
+ outputs= gr.outputs.Label(num_top_classes=len(labels)),
21
+ title=title,
22
+ description=description,
23
+ article=article,
24
+ examples=examples
25
+ )
26
+
27
+ demo.lauch()
.ipynb_checkpoints/requirements-checkpoint.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image
1005649.jpg ADDED
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ learn = load_learner('export.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 = "Food 101 Classifier"
12
+ description = "A Food 101 Classifier created using Custom Dataset from Kaggle. Created as a demo for Gradio and HuggingFace Spaces."
13
+ article="<p style='text-align: center'><a href='https://satish1v.medium.com/' target='_blank'>Blog post coming soon</a></p>"
14
+ enable_queue=True
15
+ examples = ['1005649.jpg']
16
+
17
+
18
+ demo=gr.Interface(fn=predict,
19
+ inputs=gr.inputs.Image(shape=(460, 460)),
20
+ outputs= gr.outputs.Label(num_top_classes=len(labels)),
21
+ title=title,
22
+ description=description,
23
+ article=article,
24
+ examples=examples
25
+ )
26
+
27
+ demo.lauch()
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4938bce2ef61b8eab6b0c3c6ae46a05409ef8d421cf08800594f1c9ca80f66f2
3
+ size 117087465
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image