Spaces:
Sleeping
Sleeping
Update dataset_utils.py
Browse files- dataset_utils.py +11 -1
dataset_utils.py
CHANGED
@@ -10,4 +10,14 @@ def load_insect_dataset():
|
|
10 |
def preprocess_image(image_path):
|
11 |
processor = ViTImageProcessor.from_pretrained("google/vit-base-patch16-224")
|
12 |
image = Image.open(image_path).convert("RGB")
|
13 |
-
return processor(image, return_tensors="pt")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
def preprocess_image(image_path):
|
11 |
processor = ViTImageProcessor.from_pretrained("google/vit-base-patch16-224")
|
12 |
image = Image.open(image_path).convert("RGB")
|
13 |
+
return processor(image, return_tensors="pt")
|
14 |
+
|
15 |
+
def load_species_descriptions():
|
16 |
+
# BIOSCAN-5M example structure: replace with actual implementation as needed
|
17 |
+
species_data = load_dataset("Gharaee/BIOSCAN-5M")
|
18 |
+
descriptions = {}
|
19 |
+
for record in species_data["train"]:
|
20 |
+
species_name = record.get("species_name", "Unknown Species")
|
21 |
+
description = record.get("description", "No description available.")
|
22 |
+
descriptions[species_name] = description
|
23 |
+
return descriptions
|