Update app.py
Browse files
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 |
-
|
| 34 |
-
return True
|
| 35 |
|
| 36 |
# Download dataset at startup
|
| 37 |
-
|
| 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)
|