tasmay's picture
piano keyboard classifier code
18803aa
raw
history blame
532 Bytes
import streamlit as st
from PIL import Image
from fastai.vision.all import *
import pickle
st.title("Piano or Keyboard?")
file_name = st.file_uploader("Upload a piano or a keyboard image")
model = pickle.load(open('export.pkl','rb'))
if file_name is not None:
col1, col2 = st.columns(2)
image = Image.open(file_name)
col1.image(image, use_column_width=True)
pred,pred_idx,probs = model.predict(image)
col2.header("Prediction:")
st.write('This is a ', pred, '!')
else:
st.write('Please upload a file!')