Update app.py
Browse files
app.py
CHANGED
|
@@ -2,24 +2,25 @@ import gradio as gr
|
|
| 2 |
import os
|
| 3 |
from utils import load_dicom
|
| 4 |
from model import generate_report
|
| 5 |
-
from utils import
|
| 6 |
|
| 7 |
def process_scan(dicom_files):
|
| 8 |
if not dicom_files:
|
| 9 |
-
return
|
| 10 |
|
| 11 |
-
images =
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
def run_generate(dicom_files):
|
| 15 |
if not dicom_files:
|
| 16 |
return "", gr.DownloadButton(visible=False)
|
| 17 |
|
| 18 |
-
images =
|
| 19 |
if not images:
|
| 20 |
-
return gr.
|
| 21 |
-
|
| 22 |
-
return gr.Gallery(value=images, visible=True), gr.Button(interactive=True)
|
| 23 |
|
| 24 |
report = generate_report(images)
|
| 25 |
|
|
@@ -58,7 +59,7 @@ with gr.Blocks(title="MRI Brain Report Generator") as app:
|
|
| 58 |
label="Scan Preview",
|
| 59 |
columns=3,
|
| 60 |
height="auto",
|
| 61 |
-
visible=
|
| 62 |
)
|
| 63 |
|
| 64 |
# Right column - report (empty for now)
|
|
|
|
| 2 |
import os
|
| 3 |
from utils import load_dicom
|
| 4 |
from model import generate_report
|
| 5 |
+
from utils import load_dicoms, generate_pdf
|
| 6 |
|
| 7 |
def process_scan(dicom_files):
|
| 8 |
if not dicom_files:
|
| 9 |
+
return gr.Gallery(visible=False), gr.Button(interactive=False)
|
| 10 |
|
| 11 |
+
images = load_dicoms(dicom_files)
|
| 12 |
+
if not images:
|
| 13 |
+
return gr.Gallery(visible=False), gr.Button(interactive=False)
|
| 14 |
+
|
| 15 |
+
return gr.Gallery(value=images, visible=True), gr.Button(interactive=True)
|
| 16 |
|
| 17 |
def run_generate(dicom_files):
|
| 18 |
if not dicom_files:
|
| 19 |
return "", gr.DownloadButton(visible=False)
|
| 20 |
|
| 21 |
+
images = load_dicoms(dicom_files)
|
| 22 |
if not images:
|
| 23 |
+
return gr.DownloadButton(visible=False)
|
|
|
|
|
|
|
| 24 |
|
| 25 |
report = generate_report(images)
|
| 26 |
|
|
|
|
| 59 |
label="Scan Preview",
|
| 60 |
columns=3,
|
| 61 |
height="auto",
|
| 62 |
+
visible=False
|
| 63 |
)
|
| 64 |
|
| 65 |
# Right column - report (empty for now)
|