aipatrycja commited on
Commit
e1afb6d
·
1 Parent(s): 6e23e6e

Update model

Browse files
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ gradio
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
+ from fastai.vision.all import *
2
  import gradio as gr
3
 
4
+ examples = ['/images/cloud1.jpg', '/images/cloud2.jpg', '/images/cloud3.jpg', '/images/cloud4.jpg', '/images/cloud5.jpg', '/images/cloud6.jpg', '/images/cloud7.jpg', '/images/cloud8.jpg', '/images/cloud9.jpg', '/images/cloud10.jpg']
 
5
 
6
+ categories = ('Cirrus', 'Stratus')
7
+
8
+ learn = load_learner('model.pkl')
9
+
10
+ def classify_image(img):
11
+ pred,idx,probs = learn.predict(img)
12
+ return dict(zip(categories, map(float,probs)))
13
+
14
+ image = gr.Image()
15
+ label = gr.Label()
16
+
17
+ demo = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
18
+ demo.launch()
images/cloud1.jpg ADDED
images/cloud10.jpg ADDED
images/cloud2.jpg ADDED
images/cloud3.jpg ADDED
images/cloud4.jpg ADDED
images/cloud5.jpg ADDED
images/cloud6.jpg ADDED
images/cloud7.jpg ADDED
images/cloud8.jpg ADDED
images/cloud9.jpg ADDED
model.pkl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9d1784e4560be0f46847f89a5371747ea20947ce3c9b22bef59038acedea39b9
3
- size 46967686
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a3f422bf1339a4f8022fc797a8ed25d6935da52e583cd30524daf51786dc4bc9
3
+ size 46957062