VaneshDev commited on
Commit
bcacab7
·
verified ·
1 Parent(s): 00409a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -1,5 +1,3 @@
1
-
2
-
3
  import gradio as gr
4
  from PIL import Image
5
  import torch
@@ -123,6 +121,7 @@ def predict_xray(image):
123
  <h4>Summary:</h4>
124
  <p><b>Diagnosis:</b> {top_condition}</p>
125
  <p><b>Confidence Level:</b> {confidence:.2f}%</p>
 
126
  </div>
127
  """
128
 
@@ -165,18 +164,16 @@ def create_interface():
165
  img_input = gr.Image(label="Upload Chest X-ray", type="pil")
166
  img_output = gr.HTML()
167
  summary_output = gr.HTML(label="Summary Result")
168
- gr.Button("Analyze X-ray").click(predict_xray, inputs=img_input, outputs=[img_output, summary_output])
169
 
170
  with gr.TabItem("Report Analysis"):
171
  pdf_input = gr.File(label="Upload PDF Report", file_types=[".pdf"])
172
  pdf_output = gr.Textbox(label="Extracted Summary", lines=10)
173
  summary_output_report = gr.Textbox(label="Summary Result", lines=5)
174
- gr.Button("Analyze Report").click(analyze_report, inputs=pdf_input, outputs=[pdf_output, summary_output_report])
175
 
176
  return demo
177
 
178
  if __name__ == "__main__":
179
  demo = create_interface()
180
  demo.launch(server_port=7860, ssr_mode=False)
181
-
182
-
 
 
 
1
  import gradio as gr
2
  from PIL import Image
3
  import torch
 
121
  <h4>Summary:</h4>
122
  <p><b>Diagnosis:</b> {top_condition}</p>
123
  <p><b>Confidence Level:</b> {confidence:.2f}%</p>
124
+ <p><b>Recommendation:</b> {info['recommendation']}</p>
125
  </div>
126
  """
127
 
 
164
  img_input = gr.Image(label="Upload Chest X-ray", type="pil")
165
  img_output = gr.HTML()
166
  summary_output = gr.HTML(label="Summary Result")
167
+ gr.Button("Analyze X-ray", elem_id="analyze_button").style(width=200).click(predict_xray, inputs=img_input, outputs=[img_output, summary_output])
168
 
169
  with gr.TabItem("Report Analysis"):
170
  pdf_input = gr.File(label="Upload PDF Report", file_types=[".pdf"])
171
  pdf_output = gr.Textbox(label="Extracted Summary", lines=10)
172
  summary_output_report = gr.Textbox(label="Summary Result", lines=5)
173
+ gr.Button("Analyze Report", elem_id="analyze_button").style(width=200).click(analyze_report, inputs=pdf_input, outputs=[pdf_output, summary_output_report])
174
 
175
  return demo
176
 
177
  if __name__ == "__main__":
178
  demo = create_interface()
179
  demo.launch(server_port=7860, ssr_mode=False)