Spaces:
Runtime error
Runtime error
Commit ·
2cea944
1
Parent(s): 4c4b26c
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,24 +11,30 @@ def predict(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 = '
|
| 20 |
else:
|
| 21 |
-
label = '
|
| 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(
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
iface.launch()
|
|
|
|
| 11 |
image = image / 255.0
|
| 12 |
image = np.expand_dims(image, axis=0)
|
| 13 |
|
| 14 |
+
# Make a 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(
|
| 32 |
+
fn=predict,
|
| 33 |
+
inputs=image_input,
|
| 34 |
+
outputs=label_output,
|
| 35 |
+
examples=examples,
|
| 36 |
+
title="Skin Cancer Classification",
|
| 37 |
+
description="Predicts whether a skin image is cancerous or not."
|
| 38 |
+
)
|
| 39 |
|
| 40 |
+
iface.launch()
|