SailajaS commited on
Commit
b7f9af6
Β·
verified Β·
1 Parent(s): 903e6a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -21,22 +21,19 @@ DATASET_PATH = "dataset.csv"
21
  # Function to download dataset
22
  def download_dataset():
23
  if not os.path.exists(DATASET_PATH):
24
- print("πŸ“₯ Downloading dataset...")
25
  response = requests.get(DATASET_URL)
26
-
27
  if response.status_code == 200:
28
  with open(DATASET_PATH, "wb") as file:
29
  file.write(response.content)
30
  print("βœ… Dataset downloaded successfully!")
31
  else:
32
  print(f"❌ Failed to download dataset: {response.status_code}")
33
- return False
34
- return True
35
 
36
  # Download dataset at startup
37
- dataset_downloaded = download_dataset()
38
- if not dataset_downloaded:
39
- raise Exception("❌ Unable to start app: Dataset download failed.")
40
 
41
  # Load dataset
42
  df = pd.read_csv(DATASET_PATH)
 
21
  # Function to download dataset
22
  def download_dataset():
23
  if not os.path.exists(DATASET_PATH):
24
+ print("πŸ“₯ Downloading dataset from Hugging Face...")
25
  response = requests.get(DATASET_URL)
26
+
27
  if response.status_code == 200:
28
  with open(DATASET_PATH, "wb") as file:
29
  file.write(response.content)
30
  print("βœ… Dataset downloaded successfully!")
31
  else:
32
  print(f"❌ Failed to download dataset: {response.status_code}")
33
+ raise Exception("Dataset download failed.")
 
34
 
35
  # Download dataset at startup
36
+ download_dataset()
 
 
37
 
38
  # Load dataset
39
  df = pd.read_csv(DATASET_PATH)