Rammohan0504 commited on
Commit
9ea6667
·
verified ·
1 Parent(s): 8724f83

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -14
app.py CHANGED
@@ -160,7 +160,7 @@ def save_results_to_pdf(test_results, filename):
160
  return f"Error saving PDF: {str(e)}", None
161
 
162
  # Build health card layout
163
- def build_health_card(profile_image, test_results, summary, patient_name="", patient_age="", patient_gender="", patient_id=""):
164
  from datetime import datetime
165
  current_date = datetime.now().strftime("%B %d, %Y")
166
 
@@ -203,20 +203,13 @@ def build_health_card(profile_image, test_results, summary, patient_name="", pat
203
  </div>
204
 
205
  <div style="display: flex; gap: 15px; justify-content: center; flex-wrap: wrap;">
206
- <button onclick="window.print()" style="padding: 12px 24px; background: linear-gradient(135deg, #4caf50, #45a049); color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3); transition: all 0.3s;">
207
- 📥 Download Report
208
- </button>
209
- <button style="padding: 12px 24px; background: linear-gradient(135deg, #2196f3, #1976d2); color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);">
210
- 📞 Find Labs Near Me
211
- </button>
212
  </div>
213
  </div>
214
- <style>
215
- @media print {{
216
- /* Hide input sections during print */
217
- .gradio-container {{ display: none; }}
218
- }}
219
- </style>
220
  """
221
  return html
222
 
@@ -299,7 +292,6 @@ def analyze_face(input_data):
299
  build_table("❤️ Vitals",
300
  [("SpO2", spo2, (95, 100)),
301
  ("Heart Rate", heart_rate, (60, 100)),
302
- ("Respiratory Rate", rr, (12, 20)),
303
  ("Temperature", test_values["Temperature"], (97, 99)),
304
  ("BP Systolic", test_values["BP Systolic"], (90, 120)),
305
  ("BP Diastolic", test_values["BP Diastolic"], (60, 80))])
 
160
  return f"Error saving PDF: {str(e)}", None
161
 
162
  # Build health card layout
163
+ def build_health_card(profile_image, test_results, summary, patient_name="", patient_age="", patient_gender="", patient_id="", pdf_filepath=""):
164
  from datetime import datetime
165
  current_date = datetime.now().strftime("%B %d, %Y")
166
 
 
203
  </div>
204
 
205
  <div style="display: flex; gap: 15px; justify-content: center; flex-wrap: wrap;">
206
+ <a href="{pdf_filepath}" download="Health_Report.pdf">
207
+ <button style="padding: 12px 24px; background: linear-gradient(135deg, #4caf50, #45a049); color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3); transition: all 0.3s;">
208
+ 📥 Download Report
209
+ </button>
210
+ </a>
 
211
  </div>
212
  </div>
 
 
 
 
 
 
213
  """
214
  return html
215
 
 
292
  build_table("❤️ Vitals",
293
  [("SpO2", spo2, (95, 100)),
294
  ("Heart Rate", heart_rate, (60, 100)),
 
295
  ("Temperature", test_values["Temperature"], (97, 99)),
296
  ("BP Systolic", test_values["BP Systolic"], (90, 120)),
297
  ("BP Diastolic", test_values["BP Diastolic"], (60, 80))])