Spaces:
Runtime error
Runtime error
Commit
·
99234ff
1
Parent(s):
164e569
Update app.py
Browse files
app.py
CHANGED
@@ -22,19 +22,17 @@ def predict(image):
|
|
22 |
label = 'Malignant'
|
23 |
confidence = prediction[0][0] # Confidence for malignant
|
24 |
|
25 |
-
return
|
26 |
|
27 |
-
# Custom
|
28 |
-
def
|
29 |
-
label
|
30 |
-
confidence = output['confidence'] * 100
|
31 |
-
return f"{label} ({confidence:.2f}%)"
|
32 |
|
33 |
examples = [["benign.jpg"], ["malignant.jpg"]]
|
34 |
|
35 |
-
# Define input and output components
|
36 |
image_input = gr.inputs.Image(shape=(150, 150))
|
37 |
-
label_output = gr.outputs.
|
38 |
|
39 |
# Define a Gradio interface for user interaction
|
40 |
iface = gr.Interface(
|
|
|
22 |
label = 'Malignant'
|
23 |
confidence = prediction[0][0] # Confidence for malignant
|
24 |
|
25 |
+
return label, confidence
|
26 |
|
27 |
+
# Custom component to display label with confidence
|
28 |
+
def label_with_confidence(label, confidence):
|
29 |
+
return f"{label} ({confidence * 100:.2f}%)"
|
|
|
|
|
30 |
|
31 |
examples = [["benign.jpg"], ["malignant.jpg"]]
|
32 |
|
33 |
+
# Define input and custom output components
|
34 |
image_input = gr.inputs.Image(shape=(150, 150))
|
35 |
+
label_output = gr.outputs.Component(label_with_confidence, inputs=["label", "confidence"])
|
36 |
|
37 |
# Define a Gradio interface for user interaction
|
38 |
iface = gr.Interface(
|