Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,14 @@
|
|
1 |
-
from transformers import MobileNetV2FeatureExtractor, MobileNetV2ForImageClassification
|
2 |
from PIL import Image
|
3 |
|
4 |
# Replace with the path to the directory containing the model files
|
5 |
model_folder = "mobilnetV2_ftprecmodelshuf.weights.best.hdf5"
|
6 |
|
7 |
-
# Load the
|
8 |
-
|
|
|
|
|
|
|
9 |
|
10 |
# Load the model
|
11 |
model = MobileNetV2ForImageClassification.from_pretrained(model_folder)
|
|
|
1 |
+
from transformers import MobileNetV2FeatureExtractor, MobileNetV2ForImageClassification, MobileNetV2Config
|
2 |
from PIL import Image
|
3 |
|
4 |
# Replace with the path to the directory containing the model files
|
5 |
model_folder = "mobilnetV2_ftprecmodelshuf.weights.best.hdf5"
|
6 |
|
7 |
+
# Load the configuration
|
8 |
+
config = MobileNetV2Config.from_pretrained(model_folder)
|
9 |
+
|
10 |
+
# Create the feature extractor using the loaded configuration
|
11 |
+
feature_extractor = MobileNetV2FeatureExtractor(config)
|
12 |
|
13 |
# Load the model
|
14 |
model = MobileNetV2ForImageClassification.from_pretrained(model_folder)
|