Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- .gitattributes +1 -0
- app.py +30 -0
- my_cnn_model.keras +3 -0
- requirements.txt +2 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
my_cnn_model.keras filter=lfs diff=lfs merge=lfs -text
|
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 |
+
st.title("Skin Cancer Image Classification")
|
7 |
+
st.write("Upload an image and let the model guess whether it is a cancer or not.")
|
8 |
+
|
9 |
+
model = load_model("my_cnn_model.keras")
|
10 |
+
|
11 |
+
def process_image(img):
|
12 |
+
img = img.resize((170,170)) # set the size as 170 x 170 pixel
|
13 |
+
img = np.array(img)
|
14 |
+
img = img / 255.0 # normalized
|
15 |
+
img = np.expand_dims(img, axis=0)
|
16 |
+
return img
|
17 |
+
|
18 |
+
|
19 |
+
file = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
|
20 |
+
|
21 |
+
if file is not None:
|
22 |
+
img = Image.open(file)
|
23 |
+
st.image(img, caption="Uploaded Image")
|
24 |
+
image = process_image(img)
|
25 |
+
|
26 |
+
prediction = model.predict(image)
|
27 |
+
predicted_class = np.argmax(prediction)
|
28 |
+
|
29 |
+
class_names = ["It is NOT Cancer!", "It is Cancer!"]
|
30 |
+
st.write(class_names[predicted_class])
|
my_cnn_model.keras
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2a9c7220d74b23b0acad9db9df93676548ff873445060d0c7283a471d9e8a6c5
|
3 |
+
size 165518887
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
tensorflow
|