McGregory99 commited on
Commit
e531edf
·
1 Parent(s): 0b577c3

Update app.py

Browse files
Files changed (5) hide show
  1. app.py +25 -4
  2. kiwi.jpg +0 -0
  3. manzana.jpg +0 -0
  4. model.pkl +3 -0
  5. platano.jpg +0 -0
app.py CHANGED
@@ -1,7 +1,28 @@
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
1
+ # -*- coding: utf-8 -*-
2
+ """deploy-model-gradio.ipynb
3
+
4
+ Original file is located at
5
+ https://colab.research.google.com/drive/1vMT0nd-CxKVMAA5RUePxsjX75oiipW7y
6
+ """
7
+
8
+ #|export
9
+ from fastai.vision.all import *
10
  import gradio as gr
11
 
12
+ #|export
13
+ learn = load_learner('model.pkl')
14
+
15
+ #|export
16
+ categories = ("kiwi", "manzana", "platano")
17
+
18
+ def classify_image(img):
19
+ pred, idx, probs = learn.predict(img)
20
+ return dict(zip(categories, map(float, probs)))
21
+
22
+ #|export
23
+ image = gr.inputs.Image(shape=(224,224))
24
+ label = gr.outputs.Label()
25
+ examples = ["manzana.jpg", "kiwi.jpg", "platano.jpg"]
26
 
27
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
28
+ intf.launch(inline=False)
kiwi.jpg ADDED
manzana.jpg ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:417b948e4fa65f0319e5f7ce2a96175fd687c55ebbc1916bd9815a63b4f32627
3
+ size 46964349
platano.jpg ADDED