Chris commited on
Commit
e0914e8
·
1 Parent(s): e8503d1

fix empty upload

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -10,6 +10,10 @@ DATASET_NAME = "beetle_papers"
10
 
11
  # Function to upload the files and save them to the dataset
12
  def upload_files(file_paths):
 
 
 
 
13
  # Attempt to load the dataset or create a new one if it doesn't exist
14
  try:
15
  dataset = load_dataset(f"ChristopherMarais/{DATASET_NAME}")
@@ -43,7 +47,7 @@ def upload_files(file_paths):
43
  dataset.push_to_hub(DATASET_NAME, token=HUGGINGFACE_TOKEN)
44
 
45
  # Return a message indicating the success of the uploads
46
- return f"File(s) uploaded successfully!"
47
 
48
  # Function to clear the upload file list
49
  def clear_files():
 
10
 
11
  # Function to upload the files and save them to the dataset
12
  def upload_files(file_paths):
13
+ # Check if any files were provided
14
+ if not file_paths:
15
+ return "Please select a file to upload."
16
+
17
  # Attempt to load the dataset or create a new one if it doesn't exist
18
  try:
19
  dataset = load_dataset(f"ChristopherMarais/{DATASET_NAME}")
 
47
  dataset.push_to_hub(DATASET_NAME, token=HUGGINGFACE_TOKEN)
48
 
49
  # Return a message indicating the success of the uploads
50
+ return "File(s) uploaded successfully!"
51
 
52
  # Function to clear the upload file list
53
  def clear_files():