Spaces:
Sleeping
Sleeping
Update model_utils.py
Browse files- model_utils.py +3 -2
model_utils.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
from transformers import ViTForImageClassification
|
| 4 |
from PIL import Image
|
| 5 |
import torch
|
| 6 |
-
from dataset_utils import
|
| 7 |
|
| 8 |
class BugClassifier:
|
| 9 |
def __init__(self, model_path="google/vit-base-patch16-224"):
|
|
@@ -15,7 +15,8 @@ class BugClassifier:
|
|
| 15 |
"Luna Moth", "Common Dragonfly", "Honey Bee", "Paper Wasp"
|
| 16 |
]
|
| 17 |
# Dynamically load species descriptions
|
| 18 |
-
|
|
|
|
| 19 |
|
| 20 |
def predict(self, image):
|
| 21 |
try:
|
|
|
|
| 3 |
from transformers import ViTForImageClassification
|
| 4 |
from PIL import Image
|
| 5 |
import torch
|
| 6 |
+
from dataset_utils import DatasetHandler
|
| 7 |
|
| 8 |
class BugClassifier:
|
| 9 |
def __init__(self, model_path="google/vit-base-patch16-224"):
|
|
|
|
| 15 |
"Luna Moth", "Common Dragonfly", "Honey Bee", "Paper Wasp"
|
| 16 |
]
|
| 17 |
# Dynamically load species descriptions
|
| 18 |
+
handler = DatasetHandler()
|
| 19 |
+
self.species_descriptions = handler.load_descriptions(max_records=500)
|
| 20 |
|
| 21 |
def predict(self, image):
|
| 22 |
try:
|