Update app.py
Browse files
app.py
CHANGED
|
@@ -26,6 +26,14 @@ def download_report(report_text):
|
|
| 26 |
return None
|
| 27 |
return generate_pdf(report_text)
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
# Build the UI
|
| 30 |
with gr.Blocks(title="MRI Brain Report Generator") as app:
|
| 31 |
|
|
@@ -81,4 +89,10 @@ with gr.Blocks(title="MRI Brain Report Generator") as app:
|
|
| 81 |
outputs=download_btn
|
| 82 |
)
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
app.launch()
|
|
|
|
| 26 |
return None
|
| 27 |
return generate_pdf(report_text)
|
| 28 |
|
| 29 |
+
def reset_on_clear():
|
| 30 |
+
return (
|
| 31 |
+
None, # scan_display
|
| 32 |
+
"", # report_box
|
| 33 |
+
gr.Button(interactive=False), # generate_btn
|
| 34 |
+
gr.DownloadButton(visible=False) # download_btn
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
# Build the UI
|
| 38 |
with gr.Blocks(title="MRI Brain Report Generator") as app:
|
| 39 |
|
|
|
|
| 89 |
outputs=download_btn
|
| 90 |
)
|
| 91 |
|
| 92 |
+
upload_btn.clear(
|
| 93 |
+
fn=reset_on_clear,
|
| 94 |
+
inputs=None,
|
| 95 |
+
outputs=[scan_display, report_box, generate_btn, download_btn]
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
app.launch()
|