keremali commited on
Commit
7decb1f
·
verified ·
1 Parent(s): 38bda0a

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +30 -0
  2. my_cnn_model.h5 +3 -0
  3. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from tensorflow.keras.models import load_model
3
+ from PIL import Image
4
+ import numpy as np
5
+
6
+ model = load_model("my_cnn_model.h5")
7
+
8
+
9
+ def process_image(img):
10
+ img = img.resize((170,170))
11
+ img = np.array(img)
12
+ img = img/255.0
13
+ img = np.expand_dims(img,axis=0)
14
+ return img
15
+
16
+
17
+ st.title("Image Classification - Cancer Classification :cancer: ")
18
+ st.write("Upload an image and the models predicts if it is cancer")
19
+
20
+ file = st.file_uploader("Select an image",type=["jpg","jpeg","png"])
21
+
22
+ if file is not None:
23
+ img = Image.open(file)
24
+ st.image(img,caption="Uploaded picture")
25
+ img = process_image(img)
26
+ prediction = model.predict(img)
27
+ predicted_class = np.argmax(prediction)
28
+
29
+ class_names = ["Non Cancer","Cancer"]
30
+ st.write(class_names[predicted_class])
my_cnn_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aa1548c44f128bb4e182ef9ce23763e14906f58bc1df02e7f3598b944625945a
3
+ size 165525592
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ streamlit
2
+ tensorflow