ftx7go commited on
Commit
29c4191
·
verified ·
1 Parent(s): 41658fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -17
app.py CHANGED
@@ -58,6 +58,8 @@ def send_email(patient_email, report_path, patient_name):
58
  server.login(sender_email, sender_password)
59
  server.send_message(msg)
60
 
 
 
61
  # Function to process X-ray and generate a PDF report
62
  def generate_report(name, age, gender, weight, height, allergies, cause, xray):
63
  image_size = (224, 224)
@@ -158,19 +160,15 @@ def generate_report(name, age, gender, weight, height, allergies, cause, xray):
158
  with gr.Blocks() as app:
159
  gr.HTML(html_content) # Display `re.html` content in Gradio
160
  gr.Markdown("## Bone Fracture Detection System")
161
-
162
  with gr.Row():
163
  name = gr.Textbox(label="Patient Name")
164
  age = gr.Number(label="Age")
165
  gender = gr.Radio(["Male", "Female", "Other"], label="Gender")
166
-
167
  with gr.Row():
168
  weight = gr.Number(label="Weight (kg)")
169
  height = gr.Number(label="Height (cm)")
170
-
171
- with gr.Row():
172
- allergies = gr.Textbox(label="Allergies (if any)")
173
- cause = gr.Textbox(label="Cause of Injury")
174
 
175
  with gr.Row():
176
  email = gr.Textbox(label="Patient Email", type="email")
@@ -182,17 +180,8 @@ with gr.Blocks() as app:
182
  send_email_button = gr.Button("Send Report via Email")
183
  output_file = gr.File(label="Download Report")
184
 
185
- submit_button.click(
186
- generate_report,
187
- inputs=[name, age, gender, weight, height, allergies, cause, xray],
188
- outputs=[output_file],
189
- )
190
-
191
- send_email_button.click(
192
- send_email,
193
- inputs=[email, output_file, name],
194
- outputs=[],
195
- )
196
 
197
  # Launch the Gradio app
198
  if __name__ == "__main__":
 
58
  server.login(sender_email, sender_password)
59
  server.send_message(msg)
60
 
61
+ return f"Report sent successfully to {patient_email}!"
62
+
63
  # Function to process X-ray and generate a PDF report
64
  def generate_report(name, age, gender, weight, height, allergies, cause, xray):
65
  image_size = (224, 224)
 
160
  with gr.Blocks() as app:
161
  gr.HTML(html_content) # Display `re.html` content in Gradio
162
  gr.Markdown("## Bone Fracture Detection System")
163
+
164
  with gr.Row():
165
  name = gr.Textbox(label="Patient Name")
166
  age = gr.Number(label="Age")
167
  gender = gr.Radio(["Male", "Female", "Other"], label="Gender")
168
+
169
  with gr.Row():
170
  weight = gr.Number(label="Weight (kg)")
171
  height = gr.Number(label="Height (cm)")
 
 
 
 
172
 
173
  with gr.Row():
174
  email = gr.Textbox(label="Patient Email", type="email")
 
180
  send_email_button = gr.Button("Send Report via Email")
181
  output_file = gr.File(label="Download Report")
182
 
183
+ submit_button.click(generate_report, inputs=[name, age, gender, weight, height, allergies, cause, xray], outputs=[output_file])
184
+ send_email_button.click(send_email, inputs=[email, output_file, name], outputs=[gr.Textbox(label="Status")])
 
 
 
 
 
 
 
 
 
185
 
186
  # Launch the Gradio app
187
  if __name__ == "__main__":