patrick-h commited on
Commit
1996a2f
·
1 Parent(s): d41d35d

Butterfly ver 0

Browse files
Files changed (2) hide show
  1. app.py +13 -4
  2. dense_model.pkl +3 -0
app.py CHANGED
@@ -1,7 +1,16 @@
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
+ import numpy as np
4
 
5
+ learn = load_learner('dense_model.pkl')
 
6
 
7
+ def classify_image(img):
8
+ img = np.array(img)
9
+ pred, idx, probs = learn.predict(img)
10
+ return pred
11
+
12
+ image = gr.inputs.Image(shape=(224,224))
13
+ label = gr.outputs.Label()
14
+
15
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
16
+ intf.launch(inline=False)
dense_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1661017c0d03ac43784748af5cb6b535e9ec21d6a540a83233d526ae0e81c364
3
+ size 83835918