Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,30 +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('
|
7 |
-
|
8 |
-
|
9 |
-
def process_image(img):
|
10 |
-
img= img.resize((170,170))
|
11 |
-
img = np.array(img)
|
12 |
-
img = img/255.0 # normalize
|
13 |
-
img = np.expand_dims(img,axis=0)
|
14 |
-
return img
|
15 |
-
|
16 |
-
|
17 |
-
st.title('Skin
|
18 |
-
st.write('Upload Test Image')
|
19 |
-
|
20 |
-
|
21 |
-
file = st.file_uploader('Enter Image', type=['jpg','png','jpeg'])
|
22 |
-
|
23 |
-
if file is not None:
|
24 |
-
img=Image.open(file)
|
25 |
-
st.image(img,caption='Uploaded Image')
|
26 |
-
image = process_image(img)
|
27 |
-
prediction = model.predict(image)
|
28 |
-
predicted_class = np.argmax(prediction)
|
29 |
-
class_names = ['
|
30 |
st.write(class_names[predicted_class])
|
|
|
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('skin_cancer_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 # normalize
|
13 |
+
img = np.expand_dims(img,axis=0)
|
14 |
+
return img
|
15 |
+
|
16 |
+
|
17 |
+
st.title('Skin Cancer Classification :cancer:')
|
18 |
+
st.write('Upload Test Image')
|
19 |
+
|
20 |
+
|
21 |
+
file = st.file_uploader('Enter Image', type=['jpg','png','jpeg'])
|
22 |
+
|
23 |
+
if file is not None:
|
24 |
+
img=Image.open(file)
|
25 |
+
st.image(img,caption='Uploaded Image')
|
26 |
+
image = process_image(img)
|
27 |
+
prediction = model.predict(image)
|
28 |
+
predicted_class = np.argmax(prediction)
|
29 |
+
class_names = ['Cancer !','Not Cancer !']
|
30 |
st.write(class_names[predicted_class])
|