Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
-
gr.HTML('<div style="text-align: center; margin-bottom: 20px;"><img src="insightray_icon.svg" width="100" style="display: inline-block;"/></div>')
|
| 4 |
from PIL import Image
|
| 5 |
import torch.nn.functional as F
|
| 6 |
from monai.networks.nets import DenseNet121
|
|
@@ -85,14 +84,21 @@ def predict(image_input, modality):
|
|
| 85 |
generic_report = get_generic_report(body_part, conf_body_percent)
|
| 86 |
return f"**Selected modality:** {modality}\n{generic_report}"
|
| 87 |
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
|
|
|
| 3 |
from PIL import Image
|
| 4 |
import torch.nn.functional as F
|
| 5 |
from monai.networks.nets import DenseNet121
|
|
|
|
| 84 |
generic_report = get_generic_report(body_part, conf_body_percent)
|
| 85 |
return f"**Selected modality:** {modality}\n{generic_report}"
|
| 86 |
|
| 87 |
+
# ---------- Gradio interface with logo using Blocks ----------
|
| 88 |
+
with gr.Blocks(title="InsightRay – Multi‑Modality Medical AI") as demo:
|
| 89 |
+
gr.HTML('<div style="text-align: center; margin-bottom: 20px;"><img src="insightray_icon.svg" width="100" style="display: inline-block;"/></div>')
|
| 90 |
+
gr.Markdown("## InsightRay – Multi‑Modality Medical AI")
|
| 91 |
+
gr.Markdown("Choose the image type and upload a medical image. For chest X‑ray and head CT, detailed AI reports are generated.")
|
| 92 |
+
|
| 93 |
+
with gr.Row():
|
| 94 |
+
with gr.Column():
|
| 95 |
+
image_input = gr.Image(type="pil", label="Upload Medical Image")
|
| 96 |
+
modality = gr.Radio(choices=["Chest X‑ray", "Head CT", "Hand X‑ray", "Abdomen CT", "Breast MRI", "Chest CT"],
|
| 97 |
+
label="Select Modality", value="Chest X‑ray")
|
| 98 |
+
submit_btn = gr.Button("Analyse")
|
| 99 |
+
with gr.Column():
|
| 100 |
+
output = gr.Textbox(label="AI Report", lines=20)
|
| 101 |
+
|
| 102 |
+
submit_btn.click(fn=predict, inputs=[image_input, modality], outputs=output)
|
| 103 |
+
|
| 104 |
+
demo.launch()
|