ariankhalfani commited on
Commit
f5d6d4a
1 Parent(s): 32d2049

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -202,6 +202,11 @@ def view_database():
202
 
203
  # Function to download database or image
204
  def download_file(choice):
 
 
 
 
 
205
  if choice == "Database (.db)":
206
  # Provide the path to the database file
207
  return 'results.db'
@@ -211,7 +216,7 @@ def download_file(choice):
211
  conn.close()
212
 
213
  # Save the DataFrame as an HTML file
214
- html_file_path = "/mnt/data/results.html"
215
  df.to_html(html_file_path, index=False)
216
 
217
  return html_file_path
 
202
 
203
  # Function to download database or image
204
  def download_file(choice):
205
+ # Ensure the directory exists
206
+ directory = "/mnt/data"
207
+ if not os.path.exists(directory):
208
+ os.makedirs(directory)
209
+
210
  if choice == "Database (.db)":
211
  # Provide the path to the database file
212
  return 'results.db'
 
216
  conn.close()
217
 
218
  # Save the DataFrame as an HTML file
219
+ html_file_path = os.path.join(directory, "results.html")
220
  df.to_html(html_file_path, index=False)
221
 
222
  return html_file_path