lodhrangpt commited on
Commit
4a30d12
·
verified ·
1 Parent(s): 072de63
Files changed (1) hide show
  1. model.py +0 -20
model.py DELETED
@@ -1,20 +0,0 @@
1
- from keras.models import load_model
2
- import numpy as np
3
-
4
- labels = ['Chalky Soil', 'Mary Soil', 'Sand', 'Slit SOil', 'Alluvial Soil', 'Black Soil', 'Clay Soil', 'Red Soil']
5
- MODEL_PATH = r"DenseNet121v2_95.h5"
6
-
7
- def load_CNN_model():
8
- model = load_model(MODEL_PATH)
9
- print("model loaded")
10
- return model
11
-
12
- def classify_image(img):
13
- model = load_CNN_model()
14
- prediction = model.predict(img)
15
- predicted_class = np.argmax(prediction)
16
-
17
- predicted_label = labels[predicted_class]
18
- accuracy = prediction[0][predicted_class]
19
-
20
- return predicted_label, accuracy