Spaces:
Sleeping
Sleeping
Commit
•
4c4b26c
1
Parent(s):
debfce8
Upload 6 files
Browse files- Skin_Cancer_Using_CNN.ipynb +0 -0
- app.py +34 -0
- benign.jpg +0 -0
- malignant.jpg +0 -0
- requirements.txt +1 -0
- skin_model.h5 +3 -0
Skin_Cancer_Using_CNN.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
app.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import numpy as np
|
3 |
+
from tensorflow.keras.models import load_model
|
4 |
+
|
5 |
+
# Load the trained model
|
6 |
+
model = load_model('skin_model.h5')
|
7 |
+
|
8 |
+
# Define a function to make predictions
|
9 |
+
def predict(image):
|
10 |
+
# Preprocess the image
|
11 |
+
image = image / 255.0
|
12 |
+
image = np.expand_dims(image, axis=0)
|
13 |
+
|
14 |
+
# Make prediction using the model
|
15 |
+
prediction = model.predict(image)
|
16 |
+
|
17 |
+
# Get the predicted class label
|
18 |
+
if prediction[0][0] < 0.5:
|
19 |
+
label = 'benign'
|
20 |
+
else:
|
21 |
+
label = 'malignant'
|
22 |
+
|
23 |
+
return label
|
24 |
+
|
25 |
+
examples=[["benign.jpg"], ["malignant.jpg"]]
|
26 |
+
|
27 |
+
# Define a Gradio interface for user interaction
|
28 |
+
image_input = gr.inputs.Image(shape=(150, 150))
|
29 |
+
label_output = gr.outputs.Label()
|
30 |
+
|
31 |
+
iface= gr.Interface(fn=predict, inputs=image_input, outputs=label_output, examples=examples,
|
32 |
+
title="Identifying Skin Cancer", description="Predicts whether an image of skin is cancerous or not")
|
33 |
+
|
34 |
+
iface.launch()
|
benign.jpg
ADDED
![]() |
malignant.jpg
ADDED
![]() |
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
tensorflow
|
skin_model.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9a84edf274d1f6c849828d2f9d236df965a5c7bcd35c68049b6c92187e8bc1b8
|
3 |
+
size 57212968
|