Spaces:
Sleeping
Sleeping
vihuse
commited on
Commit
•
5cef95f
1
Parent(s):
e3754aa
JunkvHealth Food model
Browse files- .ipynb_checkpoints/app-checkpoint.ipynb +6 -0
- app.ipynb +0 -0
- export.pkl +3 -0
- fastfood.jpg +0 -0
- foods/app.py +26 -0
- hf2.jpg +0 -0
- hf3.jpg +0 -0
- hf4.jpg +0 -0
- jf2.jpg +0 -0
- jf3.jpg +0 -0
- jf4.jpg +0 -0
- jf5.jpg +0 -0
.ipynb_checkpoints/app-checkpoint.ipynb
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [],
|
3 |
+
"metadata": {},
|
4 |
+
"nbformat": 4,
|
5 |
+
"nbformat_minor": 5
|
6 |
+
}
|
app.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9b6aec690ccbcd8bf8a77769ab144a3e221745f5fff10904fcce1a2c9b8d6fdd
|
3 |
+
size 46963151
|
fastfood.jpg
ADDED
foods/app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
|
2 |
+
|
3 |
+
# %% auto 0
|
4 |
+
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
|
5 |
+
|
6 |
+
# %% ../app.ipynb 1
|
7 |
+
from fastai.vision.all import *
|
8 |
+
import gradio as gr
|
9 |
+
|
10 |
+
# %% ../app.ipynb 3
|
11 |
+
learn = load_learner('export.pkl')
|
12 |
+
|
13 |
+
# %% ../app.ipynb 5
|
14 |
+
categories = ('Healthy', 'Junk')
|
15 |
+
|
16 |
+
def classify_image(img):
|
17 |
+
pred, idx, probs = learn.predict(img)
|
18 |
+
return dict(zip(categories, map(float, probs)))
|
19 |
+
|
20 |
+
# %% ../app.ipynb 7
|
21 |
+
image = gr.inputs.Image(shape=(192,192))
|
22 |
+
label = gr.outputs.Label()
|
23 |
+
examples = ['hf2.jpg', 'hf3.jpg', 'hf4.jpg', 'jf2.jpg', 'jf3.jpg', 'jf4.jpg','jf5.jpg']
|
24 |
+
|
25 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
26 |
+
intf.launch(inline=False)
|
hf2.jpg
ADDED
hf3.jpg
ADDED
hf4.jpg
ADDED
jf2.jpg
ADDED
jf3.jpg
ADDED
jf4.jpg
ADDED
jf5.jpg
ADDED