Spaces:
Runtime error
Runtime error
Upload 3 files
Browse files- app.py +29 -0
- requirements.txt +2 -0
- skin_cancer_model.h5 +3 -0
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
7 |
+
model = load_model("skin_cancer_model.h5")
|
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 |
+
st.title("SKIN CANCER CLASSIFICATION:cancer:")
|
17 |
+
st.write("Upload your image and see the results")
|
18 |
+
|
19 |
+
file = st.file_uploader("Choose an image", type=["jpg","jpeg","png"])
|
20 |
+
|
21 |
+
if file is not None:
|
22 |
+
img = Image.open(file)
|
23 |
+
st.image(img, caption="Downloaded image")
|
24 |
+
image=process_image(img)
|
25 |
+
prediction = model.predict(image)
|
26 |
+
predicted_class = np.argmax(prediction)
|
27 |
+
|
28 |
+
class_names = ["Not Cancer","Cancer"]
|
29 |
+
st.write(class_names[predicted_class])
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
tensorflow
|
skin_cancer_model.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0a5e0b6d9bb827df83d630ee571e4c02370a0f30959daba14fcc6c415de6f5a4
|
3 |
+
size 165530032
|