CGAllenger commited on
Commit
efc5d81
·
verified ·
1 Parent(s): 61805bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -129,12 +129,12 @@ def process_scan(image):
129
 
130
  # Step C: Route to Specific Model
131
  if mri_prob > xray_prob:
132
- modality_status = f"MRI Brain Scan"
133
  diagnostic_results = predict_mri(image)
134
  # We only want top 1 for MRI based on your previous UI setup
135
  top_k = 1
136
  else:
137
- modality_status = f"Chest X-Ray"
138
  diagnostic_results = predict_xray(image)
139
  # We want top 2 for X-Ray based on your previous UI setup
140
  top_k = 2
@@ -144,18 +144,15 @@ def process_scan(image):
144
  # ==========================================
145
  # 5. Define the Unified Gradio Interface
146
  # ==========================================
147
- with gr.Blocks(title="Medical Scan Classification") as interface:
148
- gr.Markdown("# 🩺 Medical Scan Classifier")
149
- gr.Markdown("Upload **any** scan (MRI Brain Scan or Chest X-Ray). The system will automatically detect the modality and route it to the appropriate diagnostic model.")
150
-
151
  with gr.Row():
152
  with gr.Column():
153
- scan_input = gr.Image(label="Upload Medical Scan")
154
- analyze_button = gr.Button("Analyze Scan", variant="primary")
155
 
156
  with gr.Column():
157
- modality_output = gr.Textbox(label="Detection Routing Status", interactive=False)
158
- diagnostic_output = gr.Label(label="Predicted Conditions")
159
 
160
  analyze_button.click(
161
  fn=process_scan,
 
129
 
130
  # Step C: Route to Specific Model
131
  if mri_prob > xray_prob:
132
+ modality_status = f"MRI Brain Scan)"
133
  diagnostic_results = predict_mri(image)
134
  # We only want top 1 for MRI based on your previous UI setup
135
  top_k = 1
136
  else:
137
+ modality_status = f"Chest X-Ray)"
138
  diagnostic_results = predict_xray(image)
139
  # We want top 2 for X-Ray based on your previous UI setup
140
  top_k = 2
 
144
  # ==========================================
145
  # 5. Define the Unified Gradio Interface
146
  # ==========================================
147
+ with gr.Blocks(title="BTech Project") as interface:
 
 
 
148
  with gr.Row():
149
  with gr.Column():
150
+ scan_input = gr.Image(label="Upload XRay or MRI Image")
151
+ analyze_button = gr.Button("Predict", variant="primary")
152
 
153
  with gr.Column():
154
+ modality_output = gr.Textbox(label="Image Type", interactive=False)
155
+ diagnostic_output = gr.Label(label="Prediction")
156
 
157
  analyze_button.click(
158
  fn=process_scan,