tasmay commited on
Commit
18803aa
1 Parent(s): 9e03531

piano keyboard classifier code

Browse files
Files changed (3) hide show
  1. app.py +17 -2
  2. export.pkl +3 -0
  3. requirements.txt +2 -0
app.py CHANGED
@@ -1,4 +1,19 @@
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 PIL import Image
3
+ from fastai.vision.all import *
4
+ import pickle
5
 
6
+ st.title("Piano or Keyboard?")
7
+ file_name = st.file_uploader("Upload a piano or a keyboard image")
8
+
9
+ model = pickle.load(open('export.pkl','rb'))
10
+
11
+ if file_name is not None:
12
+ col1, col2 = st.columns(2)
13
+ image = Image.open(file_name)
14
+ col1.image(image, use_column_width=True)
15
+ pred,pred_idx,probs = model.predict(image)
16
+ col2.header("Prediction:")
17
+ st.write('This is a ', pred, '!')
18
+ else:
19
+ st.write('Please upload a file!')
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:698138986aa82a06d739fa60a18f759a77089c0915c50bf275df2b45ad14fb08
3
+ size 46955108
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ streamlit
2
+ fastai