VaneshDev commited on
Commit
88287ce
·
verified ·
1 Parent(s): 16bb7a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -160,8 +160,10 @@ def create_interface():
160
  with gr.Row():
161
  with gr.Column(scale=1):
162
  xray_input = gr.Image(label="Upload X-ray", type="pil", elem_id="xray-input")
 
163
  with gr.Column(scale=1):
164
  report_input = gr.File(label="Upload Patient Report (PDF)", file_count="single", elem_id="report-input")
 
165
 
166
  with gr.Row():
167
  predict_button = gr.Button("Analyze X-ray", elem_classes="gradio-button")
@@ -182,9 +184,21 @@ def create_interface():
182
  fn=analyze_report,
183
  inputs=report_input,
184
  outputs=report_output)
185
-
 
 
 
 
 
 
 
 
 
 
 
 
186
  return demo
187
 
188
  # Launch the interface and save model after training (to be implemented by user)
189
  demo = create_interface()
190
- demo.launch(share=True)
 
160
  with gr.Row():
161
  with gr.Column(scale=1):
162
  xray_input = gr.Image(label="Upload X-ray", type="pil", elem_id="xray-input")
163
+ clear_xray_button = gr.Button("Clear X-ray", elem_classes="gradio-button")
164
  with gr.Column(scale=1):
165
  report_input = gr.File(label="Upload Patient Report (PDF)", file_count="single", elem_id="report-input")
166
+ clear_report_button = gr.Button("Clear Report", elem_classes="gradio-button")
167
 
168
  with gr.Row():
169
  predict_button = gr.Button("Analyze X-ray", elem_classes="gradio-button")
 
184
  fn=analyze_report,
185
  inputs=report_input,
186
  outputs=report_output)
187
+
188
+ # Clear buttons functionality
189
+ clear_xray_button.click(
190
+ fn=lambda: None, # Reset the x-ray image input
191
+ inputs=[],
192
+ outputs=[xray_input]
193
+ )
194
+ clear_report_button.click(
195
+ fn=lambda: None, # Reset the report file input
196
+ inputs=[],
197
+ outputs=[report_input]
198
+ )
199
+
200
  return demo
201
 
202
  # Launch the interface and save model after training (to be implemented by user)
203
  demo = create_interface()
204
+ demo.launch(share=True)