kaz9112 commited on
Commit
d3aa9ac
1 Parent(s): 468bb19

first upload

Browse files
.gitattributes CHANGED
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ *.data-00000-of-00001 filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import requests
3
+ import numpy as np
4
+ import json
5
+ from skimage.transform import resize
6
+ from PIL import Image
7
+ import tensorflow as tf
8
+ from tensorflow.keras.models import Sequential, Model
9
+
10
+ model = tf.keras.models.load_model('model_a')
11
+
12
+ # Load page
13
+ def run():
14
+ # widget input
15
+ with st.form(key='form_parameters'):
16
+ st.title("Apple or Orange")
17
+ uploaded_file = st.file_uploader("Insert a picture (jpg or jpeg)", type=['jpg','jpeg'])
18
+
19
+ st.markdown('---')
20
+ submitted = st.form_submit_button('Predict')
21
+
22
+ if submitted:
23
+ image = Image.open(uploaded_file)
24
+ np_img = np.asarray(image)
25
+ resized = resize(np_img, (256,256),anti_aliasing=True)
26
+ # st.write(resized.shape)
27
+ x = np.expand_dims(resized, axis=0)
28
+ images = np.vstack([x])
29
+ classes = model.predict(images)
30
+ # st.write(res['predictions'][0][0])
31
+ print(classes)
32
+ if classes[0][0] <= 0.1:
33
+ st.write('Apple')
34
+ elif classes[0][0] >= 0.9:
35
+ st.write('Orange')
36
+ else:
37
+ st.write('Unknown')
38
+
39
+ st.image(resized)
40
+
41
+
42
+ if __name__ == '__main__':
43
+ run()
model_a/keras_metadata.pb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:acbe534c81b20909af72d8fb5a8a815e07d0a03bef74f0bd10e5a26b58b62b66
3
+ size 482878
model_a/saved_model.pb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1031137a2555a84b69cc6b31d5dd97994783eb31d67e8d6ab4fce493b8957c7f
3
+ size 2935963
model_a/variables/variables.data-00000-of-00001 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aad51728d24d1372f7a527e48a88d2e76a7bfe7c02362821db1c75e75416ba5a
3
+ size 86916974
model_a/variables/variables.index ADDED
Binary file (15.5 kB). View file
 
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ requests
2
+ numpy
3
+ typing_extensions
4
+ joblib
5
+ scikit-image==0.19.2
6
+ pillow == 9.4.0
7
+ tensorflow == 2.11.0