Mike Chen commited on
Commit
b22a0c6
1 Parent(s): 1691a02

Create model

Browse files
Files changed (4) hide show
  1. app.py +13 -2
  2. condensed_model.pkl +3 -0
  3. model.pkl +3 -0
  4. model_with_all.pkl +3 -0
app.py CHANGED
@@ -1,7 +1,18 @@
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
  import gradio as gr
2
+ from fastai.vision.all import *
3
 
4
  def greet(name):
5
  return "Hello " + name + "!!"
6
 
7
+ learn = load_learner('condensed_model.pkl')
8
+
9
+ def classify_image(image):
10
+ prediction, idx, probabilities = learn.predict(image)
11
+ return dict(zip(learn.dls.vocab, map(float, probabilities)))
12
+
13
+ image = gr.inputs.Image(shape=(224, 224))
14
+ label = gr.outputs.Label(num_top_classes=3)
15
+
16
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, capture_session=True)
17
+
18
+ intf.launch(inline=False)
condensed_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:de2ef000eada35bb6bc1d7c393a4512f07f7bde43f324f6e72c938be0d906317
3
+ size 46967087
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4ceaafec83536ea112aaeaba78bfeed4820c8f2b63420ff82672d954d86d5568
3
+ size 46975599
model_with_all.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da0b16e38af9891140f42ed61b3818a663818554b246604dea30e5f4e55ea6f4
3
+ size 46995375