BenyGh2003 commited on
Commit
a557b41
1 Parent(s): ee03c37

Upload 6 files

Browse files
Files changed (6) hide show
  1. app.py +34 -0
  2. benign.jpg +0 -0
  3. malignant.jpg +0 -0
  4. requirements.txt +1 -0
  5. skin-cancer-using-cnn.ipynb +0 -0
  6. skin_model.h5 +3 -0
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.png"], ["malignant.png"]]
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(share=True)
benign.jpg ADDED
malignant.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ tensorflow
skin-cancer-using-cnn.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
skin_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a84edf274d1f6c849828d2f9d236df965a5c7bcd35c68049b6c92187e8bc1b8
3
+ size 57212968