commit3
Browse files- app.py +15 -4
- fat.jfif +0 -0
- fat1.jfif +0 -0
- skinny.jfif +0 -0
- skinny1.jfif +0 -0
app.py
CHANGED
@@ -1,7 +1,18 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
1 |
+
|
2 |
+
from fastai.vision.all import *
|
3 |
import gradio as gr
|
4 |
|
5 |
+
learn = load_learner('model.pkl')
|
6 |
+
|
7 |
+
categories = ('Fat' , 'Skinny')
|
8 |
+
|
9 |
+
def classify_image(img):
|
10 |
+
pred,idx,probs = learn.predict(img)
|
11 |
+
return dict(zip(categories, map(float,probs)))
|
12 |
+
|
13 |
+
image = gr.inputs.Image(shape=(192, 192))
|
14 |
+
label = gr.outputs.Label()
|
15 |
+
examples = ['fat.jfif', 'fat1.jfif', 'skinny.jfif', 'skinny1.jfif']
|
16 |
|
17 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
18 |
+
intf.launch(inline=False)
|
fat.jfif
ADDED
Binary file (129 kB). View file
|
|
fat1.jfif
ADDED
Binary file (115 kB). View file
|
|
skinny.jfif
ADDED
Binary file (84.9 kB). View file
|
|
skinny1.jfif
ADDED
Binary file (148 kB). View file
|
|