squiroga commited on
Commit
7f2870c
·
1 Parent(s): 472e8b3

basic model prediction

Browse files
Cat_November_2010-1a.jpg ADDED
Dog_1098119012_Teaser.png ADDED
German-shepherd.png ADDED
app.py CHANGED
@@ -1,4 +1,16 @@
1
  import streamlit as st
 
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ from fastai.vision.all import *
3
 
4
+ def is_cat(x) : return x[0].isupper()
5
+
6
+ learn = load_learner('model.pkl')
7
+
8
+ categories = ('Dog', 'Cat')
9
+
10
+ def classify_image(img):
11
+ pred,idx,probs = learn.predict(img)
12
+ return dict(zip(categories,map(float,probs)))
13
+
14
+ image = st.file_uploader("Choose a file")
15
+
16
+ label = st.write(classify_image(image))
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb83624a71f64fcfc2e3a0f392b5137e84183f95f6a610ec6f746537a016d966
3
+ size 47063057