Spaces:
Runtime error
Runtime error
Commit
·
164e569
1
Parent(s):
03082bc
Update app.py
Browse files
app.py
CHANGED
@@ -24,16 +24,17 @@ def predict(image):
|
|
24 |
|
25 |
return {'label': label, 'confidence': float(confidence)} # Convert confidence to float
|
26 |
|
27 |
-
# Custom post-processing function to
|
28 |
def custom_postprocess(output):
|
29 |
-
|
30 |
-
|
|
|
31 |
|
32 |
examples = [["benign.jpg"], ["malignant.jpg"]]
|
33 |
|
34 |
# Define input and output components
|
35 |
image_input = gr.inputs.Image(shape=(150, 150))
|
36 |
-
label_output = gr.outputs.Label(
|
37 |
|
38 |
# Define a Gradio interface for user interaction
|
39 |
iface = gr.Interface(
|
|
|
24 |
|
25 |
return {'label': label, 'confidence': float(confidence)} # Convert confidence to float
|
26 |
|
27 |
+
# Custom post-processing function to format the label and confidence
|
28 |
def custom_postprocess(output):
|
29 |
+
label = output['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.Label()
|
38 |
|
39 |
# Define a Gradio interface for user interaction
|
40 |
iface = gr.Interface(
|