devdata commited on
Commit
3d0818e
·
1 Parent(s): 233a11e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
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 feature extractor
8
- feature_extractor = MobileNetV2FeatureExtractor.from_pretrained(model_folder)
 
 
 
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)