Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,15 +15,20 @@ def classify_image(image):
|
|
15 |
# Get the predicted label and confidence
|
16 |
predicted_label = logits.argmax(dim=1).item()
|
17 |
confidence = logits.softmax(dim=1).max().item()
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
# Define the Gradio interface
|
21 |
iface = gr.Interface(
|
22 |
fn=classify_image,
|
23 |
inputs=gr.inputs.Image(),
|
24 |
outputs="json",
|
25 |
-
title="
|
26 |
-
description="
|
27 |
)
|
28 |
|
29 |
# Launch the Gradio interface
|
|
|
15 |
# Get the predicted label and confidence
|
16 |
predicted_label = logits.argmax(dim=1).item()
|
17 |
confidence = logits.softmax(dim=1).max().item()
|
18 |
+
|
19 |
+
# Map predicted label to "benigno" or "maligno"
|
20 |
+
class_names = ["benigno", "maligno"]
|
21 |
+
predicted_class = class_names[predicted_label]
|
22 |
+
|
23 |
+
return {"prediction": predicted_class, "confidence": confidence}
|
24 |
|
25 |
# Define the Gradio interface
|
26 |
iface = gr.Interface(
|
27 |
fn=classify_image,
|
28 |
inputs=gr.inputs.Image(),
|
29 |
outputs="json",
|
30 |
+
title="Classificação de Imagens de Câncer de Mama",
|
31 |
+
description="Este aplicativo classifica imagens de câncer de mama em diferentes classes."
|
32 |
)
|
33 |
|
34 |
# Launch the Gradio interface
|