ariankhalfani commited on
Commit
fbd87f3
1 Parent(s): 40136e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -12
app.py CHANGED
@@ -177,22 +177,27 @@ def append_patient_info_to_html(name, age, medical_record, sex, result, predicte
177
  <html>
178
  <body>
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 without raw predictions
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:
@@ -200,7 +205,6 @@ def append_patient_info_to_html(name, age, medical_record, sex, result, predicte
200
 
201
  return str(html_db_file) # Return the HTML file path for download
202
 
203
-
204
  # Function to download the folders
205
  def download_folder(folder):
206
  zip_path = os.path.join(tempfile.gettempdir(), f"{folder}.zip")
 
177
  <html>
178
  <body>
179
  <h1>Patient Prediction Database</h1>
180
+ <table border="1" style="width:100%; border-collapse: collapse; text-align: center;">
181
  <tr>
182
+ <th>Name</th>
183
+ <th>Age</th>
184
+ <th>Medical Record</th>
185
+ <th>Sex</th>
186
+ <th>Result</th>
187
+ <th>Predicted Image</th>
188
  </tr>
189
  """)
190
 
191
+ # Append patient data in a horizontal format (values for each field under the corresponding header)
192
  html_entry = f"""
193
+ <tr>
194
+ <td>{name}</td>
195
+ <td>{age}</td>
196
+ <td>{medical_record}</td>
197
+ <td>{sex}</td>
198
+ <td>{result}</td>
199
+ <td><img src="data:image/png;base64,{predicted_image_base64}" alt="Predicted Image" width="150"></td>
200
+ </tr>
201
  """
202
 
203
  with open(html_db_file, 'a') as f:
 
205
 
206
  return str(html_db_file) # Return the HTML file path for download
207
 
 
208
  # Function to download the folders
209
  def download_folder(folder):
210
  zip_path = os.path.join(tempfile.gettempdir(), f"{folder}.zip")