Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,7 +21,7 @@ conditions = [
|
|
| 21 |
]
|
| 22 |
|
| 23 |
# Load and configure the model
|
| 24 |
-
model = models.densenet121(
|
| 25 |
num_features = model.classifier.in_features
|
| 26 |
model.classifier = torch.nn.Linear(num_features, len(conditions)) # Output for all 24 conditions
|
| 27 |
model.eval()
|
|
@@ -158,6 +158,7 @@ def create_interface():
|
|
| 158 |
gr.Markdown("<p style='text-align: center; color: #666;'>AI-powered analysis for X-rays and patient reports</p>")
|
| 159 |
|
| 160 |
with gr.TabbedInterface() as tabs:
|
|
|
|
| 161 |
with gr.Tab("X-ray Analysis"):
|
| 162 |
with gr.Row():
|
| 163 |
xray_input = gr.Image(label="Upload X-ray", type="pil", elem_id="xray-input")
|
|
@@ -182,6 +183,7 @@ def create_interface():
|
|
| 182 |
outputs=[xray_input]
|
| 183 |
)
|
| 184 |
|
|
|
|
| 185 |
with gr.Tab("Report Analysis"):
|
| 186 |
with gr.Row():
|
| 187 |
report_input = gr.File(label="Upload Patient Report (PDF)", file_count="single", elem_id="report-input")
|
|
|
|
| 21 |
]
|
| 22 |
|
| 23 |
# Load and configure the model
|
| 24 |
+
model = models.densenet121(weights="IMAGENET1K_V1") # DenseNet pre-trained on ImageNet
|
| 25 |
num_features = model.classifier.in_features
|
| 26 |
model.classifier = torch.nn.Linear(num_features, len(conditions)) # Output for all 24 conditions
|
| 27 |
model.eval()
|
|
|
|
| 158 |
gr.Markdown("<p style='text-align: center; color: #666;'>AI-powered analysis for X-rays and patient reports</p>")
|
| 159 |
|
| 160 |
with gr.TabbedInterface() as tabs:
|
| 161 |
+
# Tab for X-ray Analysis
|
| 162 |
with gr.Tab("X-ray Analysis"):
|
| 163 |
with gr.Row():
|
| 164 |
xray_input = gr.Image(label="Upload X-ray", type="pil", elem_id="xray-input")
|
|
|
|
| 183 |
outputs=[xray_input]
|
| 184 |
)
|
| 185 |
|
| 186 |
+
# Tab for Report Analysis
|
| 187 |
with gr.Tab("Report Analysis"):
|
| 188 |
with gr.Row():
|
| 189 |
report_input = gr.File(label="Upload Patient Report (PDF)", file_count="single", elem_id="report-input")
|