CGAllenger commited on
Commit
395b9e7
·
verified ·
1 Parent(s): 3b6abf7

adjust result screen

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  import numpy as np
3
  import tensorflow as tf
4
  from PIL import Image
5
- import efficientnet.tfkeras as efn # <-- Add this import
6
 
7
  # ==========================================
8
  # 1. MRI Model Setup (Your Existing Model)
@@ -28,7 +28,6 @@ def predict_mri(image):
28
  confidences = {mri_class_names[i]: float(predictions[i]) for i in range(len(mri_class_names))}
29
  return confidences
30
 
31
-
32
  # ==========================================
33
  # 2. X-Ray Model Setup (Using original EfficientNet library)
34
  # ==========================================
@@ -84,7 +83,6 @@ def predict_xray(image):
84
  confidences = {xray_class_names[i]: float(predictions[i]) for i in range(len(xray_class_names))}
85
  return confidences
86
 
87
-
88
  # ==========================================
89
  # 3. Define the Gradio Interface with Tabs
90
  # ==========================================
@@ -111,7 +109,8 @@ with gr.Blocks(title="Medical Scan Classification") as interface:
111
  xray_input = gr.Image(label="Upload Chest X-Ray")
112
  xray_button = gr.Button("Classify X-Ray", variant="primary")
113
  with gr.Column():
114
- xray_output = gr.Label(num_top_classes=5, label="Top 5 Predicted Conditions")
 
115
 
116
  xray_button.click(fn=predict_xray, inputs=xray_input, outputs=xray_output)
117
 
 
2
  import numpy as np
3
  import tensorflow as tf
4
  from PIL import Image
5
+ import efficientnet.tfkeras as efn
6
 
7
  # ==========================================
8
  # 1. MRI Model Setup (Your Existing Model)
 
28
  confidences = {mri_class_names[i]: float(predictions[i]) for i in range(len(mri_class_names))}
29
  return confidences
30
 
 
31
  # ==========================================
32
  # 2. X-Ray Model Setup (Using original EfficientNet library)
33
  # ==========================================
 
83
  confidences = {xray_class_names[i]: float(predictions[i]) for i in range(len(xray_class_names))}
84
  return confidences
85
 
 
86
  # ==========================================
87
  # 3. Define the Gradio Interface with Tabs
88
  # ==========================================
 
109
  xray_input = gr.Image(label="Upload Chest X-Ray")
110
  xray_button = gr.Button("Classify X-Ray", variant="primary")
111
  with gr.Column():
112
+ # CHANGE APPLIED HERE: num_top_classes changed to 2, and label updated
113
+ xray_output = gr.Label(num_top_classes=2, label="Top 2 Predicted Conditions")
114
 
115
  xray_button.click(fn=predict_xray, inputs=xray_input, outputs=xray_output)
116