Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -157,57 +157,10 @@ def create_interface():
|
|
| 157 |
gr.Markdown("<h1 class='title'>RadiologyScan AI</h1>")
|
| 158 |
gr.Markdown("<p style='text-align: center; color: #666;'>AI-powered analysis for X-rays and patient reports</p>")
|
| 159 |
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
with gr.Row():
|
| 167 |
-
predict_button = gr.Button("Analyze X-ray", elem_classes="gradio-button")
|
| 168 |
-
with gr.Column():
|
| 169 |
-
xray_output = gr.HTML(label="X-ray Diagnosis Summary", elem_classes="result-box")
|
| 170 |
-
xray_result = gr.HTML(label="Detailed X-ray Results", elem_classes="result-box")
|
| 171 |
-
additional_feedback = gr.HTML(label="Additional Feedback", elem_classes="result-box")
|
| 172 |
-
|
| 173 |
-
predict_button.click(
|
| 174 |
-
fn=predict_xray,
|
| 175 |
-
inputs=xray_input,
|
| 176 |
-
outputs=[xray_output, xray_result, additional_feedback]
|
| 177 |
-
)
|
| 178 |
-
|
| 179 |
-
# Clear X-ray button functionality
|
| 180 |
-
clear_xray_button.click(
|
| 181 |
-
fn=lambda: None, # Reset the x-ray image input
|
| 182 |
-
inputs=[],
|
| 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")
|
| 190 |
-
clear_report_button = gr.Button("Clear Report", elem_classes="gradio-button")
|
| 191 |
-
with gr.Row():
|
| 192 |
-
report_button = gr.Button("Analyze Report", elem_classes="gradio-button")
|
| 193 |
-
with gr.Column():
|
| 194 |
-
report_output = gr.Textbox(label="Report Summary", interactive=False, elem_classes="result-box")
|
| 195 |
-
|
| 196 |
-
report_button.click(
|
| 197 |
-
fn=analyze_report,
|
| 198 |
-
inputs=report_input,
|
| 199 |
-
outputs=report_output
|
| 200 |
-
)
|
| 201 |
-
|
| 202 |
-
# Clear Report button functionality
|
| 203 |
-
clear_report_button.click(
|
| 204 |
-
fn=lambda: None, # Reset the report file input
|
| 205 |
-
inputs=[],
|
| 206 |
-
outputs=[report_input]
|
| 207 |
-
)
|
| 208 |
-
|
| 209 |
-
return demo
|
| 210 |
-
|
| 211 |
-
# Launch the interface
|
| 212 |
demo = create_interface()
|
| 213 |
-
demo.launch(share=True)
|
|
|
|
| 157 |
gr.Markdown("<h1 class='title'>RadiologyScan AI</h1>")
|
| 158 |
gr.Markdown("<p style='text-align: center; color: #666;'>AI-powered analysis for X-rays and patient reports</p>")
|
| 159 |
|
| 160 |
+
# Correctly provide interface_list to TabbedInterface
|
| 161 |
+
xray_tab = gr.Interface(fn=predict_xray, inputs=gr.Image(label="Upload X-ray", type="pil"), outputs=[gr.HTML(), gr.HTML(), gr.HTML()])
|
| 162 |
+
report_tab = gr.Interface(fn=analyze_report, inputs=gr.File(label="Upload Patient Report (PDF)", file_count="single"), outputs=gr.Textbox(label="Report Summary", interactive=False))
|
| 163 |
+
|
| 164 |
+
gr.TabbedInterface([xray_tab, report_tab], tab_names=["X-ray Analysis", "Report Analysis"]).launch(share=True)
|
| 165 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
demo = create_interface()
|
|
|