DHEIVER commited on
Commit
edd67ee
·
1 Parent(s): 415b382

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
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
- return {"prediction": predicted_label, "confidence": confidence}
 
 
 
 
 
19
 
20
  # Define the Gradio interface
21
  iface = gr.Interface(
22
  fn=classify_image,
23
  inputs=gr.inputs.Image(),
24
  outputs="json",
25
- title="Breast Cancer Image Classification",
26
- description="This application classifies breast cancer images into different classes."
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