ariankhalfani commited on
Commit
76b9e1c
1 Parent(s): 48484aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -15
app.py CHANGED
@@ -165,6 +165,9 @@ def add_text_and_watermark(image, name, age, medical_record, sex, label):
165
 
166
  return image_with_watermark
167
 
 
 
 
168
  # Function to append patient info and image to HTML database
169
  def append_patient_info_to_html(name, age, medical_record, sex, result, predicted_image_base64):
170
  # Check if the table header is already present
@@ -176,25 +179,20 @@ def append_patient_info_to_html(name, age, medical_record, sex, result, predicte
176
  <h1>Patient Prediction Database</h1>
177
  <table border="1" style="width:100%; border-collapse: collapse; text-align: left;">
178
  <tr>
179
- <th>Name</th>
180
- <th>Age</th>
181
- <th>Medical Record</th>
182
- <th>Sex</th>
183
- <th>Result</th>
184
- <th>Predicted Image</th>
185
  </tr>
186
  """)
187
 
188
- # Append patient data as a new row in the table
189
  html_entry = f"""
190
- <tr>
191
- <td>{name}</td>
192
- <td>{age}</td>
193
- <td>{medical_record}</td>
194
- <td>{sex}</td>
195
- <td>{result}</td>
196
- <td><img src="data:image/png;base64,{predicted_image_base64}" alt="Predicted Image" width="150"></td>
197
- </tr>
198
  """
199
 
200
  with open(html_db_file, 'a') as f:
 
165
 
166
  return image_with_watermark
167
 
168
+ # Function to append patient info and image to HTML database
169
+ import os
170
+
171
  # Function to append patient info and image to HTML database
172
  def append_patient_info_to_html(name, age, medical_record, sex, result, predicted_image_base64):
173
  # Check if the table header is already present
 
179
  <h1>Patient Prediction Database</h1>
180
  <table border="1" style="width:100%; border-collapse: collapse; text-align: left;">
181
  <tr>
182
+ <th>Field</th>
183
+ <th>Data</th>
 
 
 
 
184
  </tr>
185
  """)
186
 
187
+ # Append patient data vertically in a single column structure
188
  html_entry = f"""
189
+ <tr><td><strong>Name</strong></td><td>{name}</td></tr>
190
+ <tr><td><strong>Age</strong></td><td>{age}</td></tr>
191
+ <tr><td><strong>Medical Record</strong></td><td>{medical_record}</td></tr>
192
+ <tr><td><strong>Sex</strong></td><td>{sex}</td></tr>
193
+ <tr><td><strong>Result</strong></td><td>{result}</td></tr>
194
+ <tr><td><strong>Predicted Image</strong></td><td><img src="data:image/png;base64,{predicted_image_base64}" alt="Predicted Image" width="150"></td></tr>
195
+ <tr><td colspan="2"><hr></td></tr>
 
196
  """
197
 
198
  with open(html_db_file, 'a') as f: