Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import tensorflow as tf
|
| 2 |
+
from PIL import Image
|
| 3 |
+
import numpy as np
|
| 4 |
+
import streamlit as st
|
| 5 |
+
|
| 6 |
+
img = st.file_uploader("Choose a file")
|
| 7 |
+
model = tf.keras.models.load_model('RockPaperScissor.h5')
|
| 8 |
+
if img is not None:
|
| 9 |
+
img = Image.open(img)
|
| 10 |
+
img = img.resize((256,256))
|
| 11 |
+
img = np.reshape(img,(1,256,256,3))
|
| 12 |
+
pred = model.predict(img)
|
| 13 |
+
pred = np.argmax(pred)
|
| 14 |
+
if pred == 0:
|
| 15 |
+
st.write('PAPER')
|
| 16 |
+
elif pred == 1:
|
| 17 |
+
st.write('ROCK')
|
| 18 |
+
elif:
|
| 19 |
+
st.write('SCISSOR')
|