Skip to content

Commit b365055

Browse files
authored
Update generate_dataset.py
1 parent 879976e commit b365055

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

code/04.Finetuning/generate_dataset.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ def download_image(image_url, save_path):
2626
return False
2727

2828
# Download the dataset from Hugging Face
29-
dataset = load_dataset('DBQ/Burberry.Product.prices.United.States')
30-
# Examples. dataset = load_dataset('DBQ/Burberry.Product.prices.United.States')
29+
# Simply replace DataSet with the Hugging Face DataSet name
30+
# Example. dataset = load_dataset('DBQ/Burberry.Product.prices.United.States')
31+
dataset = load_dataset('DataSet')
3132

3233
# Convert the Hugging Face dataset to a Pandas DataFrame
3334
df = dataset['train'].to_pandas()
3435

35-
# Create directories to save the dataset and images
36-
dataset_dir = './data/burberry_dataset'
36+
# Create directories to save the dataset and images to a folder
37+
# Example. dataset_dir = './data/burberry_dataset'
38+
dataset_dir = './data/Dataset'
39+
3740
images_dir = os.path.join(dataset_dir, 'images')
3841
os.makedirs(images_dir, exist_ok=True)
3942

@@ -50,8 +53,11 @@ def download_image(image_url, save_path):
5053
# Create a new DataFrame with the filtered rows
5154
filtered_df = pd.DataFrame(filtered_rows)
5255

53-
# Save the updated dataset to disk
54-
dataset_path = os.path.join(dataset_dir, 'burberry_dataset.csv')
56+
# Save the updated dataset to disk in a CSV format
57+
# Example. dataset_path = os.path.join(dataset_dir, 'burberry_dataset.csv')
58+
# dataset_path = os.path.join(dataset_dir, 'burberry_dataset.csv')
59+
dataset_path = os.path.join(dataset_dir, 'Dataset.csv')
60+
5561
filtered_df.to_csv(dataset_path, index=False)
5662

5763
print(f"Dataset and images saved to {dataset_dir}")

0 commit comments

Comments
 (0)