File size: 532 Bytes
9e03531
18803aa
 
 
9e03531
18803aa
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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!')