uruguayai commited on
Commit
649234d
·
verified ·
1 Parent(s): 1f8900f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -14
app.py CHANGED
@@ -86,20 +86,24 @@ try:
86
 
87
  except Exception as e:
88
  print(f"Error loading or processing dataset: {str(e)}")
89
- print("Attempting to load from local path...")
90
- local_path = "/home/user/app/uruguayai/montevideo"
91
- if os.path.exists(local_path):
92
- print(f"Local path exists. Contents: {os.listdir(local_path)}")
93
- dataset = load_dataset("imagefolder", data_dir=local_path)
94
- print("Dataset structure:", dataset)
95
- print("Available splits:", dataset.keys())
96
- if "train" in dataset:
97
- processed_dataset = dataset["train"].map(preprocess_images, batched=True, remove_columns=dataset["train"].column_names)
98
- print(f"Processed dataset size: {len(processed_dataset)}")
99
- else:
100
- raise ValueError("The local dataset does not contain a 'train' split.")
101
- else:
102
- raise ValueError(f"Local path {local_path} does not exist.")
 
 
 
 
103
 
104
  # Training function
105
  def train_step(state, batch, rng):
 
86
 
87
  except Exception as e:
88
  print(f"Error loading or processing dataset: {str(e)}")
89
+ print("Attempting to find dataset...")
90
+
91
+ # List contents of current directory and parent directories
92
+ print("Current directory contents:")
93
+ print(os.listdir('.'))
94
+ print("Parent directory contents:")
95
+ print(os.listdir('..'))
96
+ print("Root directory contents:")
97
+ print(os.listdir('/'))
98
+
99
+ # Try to find any directory that might contain the dataset
100
+ for root, dirs, files in os.walk('/'):
101
+ if 'montevideo' in dirs:
102
+ print(f"Found 'montevideo' directory at: {os.path.join(root, 'montevideo')}")
103
+ print(f"Contents: {os.listdir(os.path.join(root, 'montevideo'))}")
104
+
105
+ raise ValueError("Unable to locate or load the dataset. Please check the dataset path and permissions.")
106
+
107
 
108
  # Training function
109
  def train_step(state, batch, rng):