ariankhalfani commited on
Commit
259a2bb
1 Parent(s): 7d7eb41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -203,7 +203,7 @@ def view_database():
203
 
204
  # Function to download database or HTML file
205
  def download_file(choice):
206
- directory = "/mnt/data"
207
 
208
  # Ensure the directory exists
209
  if not os.path.exists(directory):
@@ -238,6 +238,8 @@ def download_file(choice):
238
 
239
  # Return the path to the HTML file
240
  return html_file_path
 
 
241
 
242
  # Initialize the database
243
  init_db()
@@ -265,6 +267,8 @@ def download_interface(choice):
265
  return file.read(), file_path.split('/')[-1]
266
  except FileNotFoundError as e:
267
  return str(e), None
 
 
268
 
269
  # Gradio Blocks
270
  with gr.Blocks() as demo:
 
203
 
204
  # Function to download database or HTML file
205
  def download_file(choice):
206
+ directory = tempfile.gettempdir()
207
 
208
  # Ensure the directory exists
209
  if not os.path.exists(directory):
 
238
 
239
  # Return the path to the HTML file
240
  return html_file_path
241
+ else:
242
+ raise ValueError("Invalid choice. Please select a valid format.")
243
 
244
  # Initialize the database
245
  init_db()
 
267
  return file.read(), file_path.split('/')[-1]
268
  except FileNotFoundError as e:
269
  return str(e), None
270
+ except ValueError as e:
271
+ return str(e), None
272
 
273
  # Gradio Blocks
274
  with gr.Blocks() as demo: