File size: 511 Bytes
0574cff
 
 
 
 
 
 
 
 
 
 
 
8cb52ea
0574cff
 
 
 
 
1911d83
0574cff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import tensorflow as tf 
from PIL import Image
import numpy as np 
import streamlit as st 

img = st.file_uploader("Choose a file")
model = tf.keras.models.load_model('RockPaperScissor.h5')
if img is not None:
    img = Image.open(img)
    img = img.resize((256,256))
    img = np.reshape(img,(1,256,256,3))
    pred = model.predict(img)
    st.write(pred)
    pred = np.argmax(pred)
    if pred == 0:
        st.write('PAPER')
    elif pred == 1:
        st.write('ROCK')
    else:
        st.write('SCISSOR')