keivan commited on
Commit
70d1f62
1 Parent(s): 04897bc
Files changed (5) hide show
  1. app.py +15 -4
  2. fat.jfif +0 -0
  3. fat1.jfif +0 -0
  4. skinny.jfif +0 -0
  5. skinny1.jfif +0 -0
app.py CHANGED
@@ -1,7 +1,18 @@
 
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Good job " + name + "!! :))"
 
 
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
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