Praneeth383 commited on
Commit
4a7a2a8
·
1 Parent(s): 4aa383e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -16
app.py CHANGED
@@ -6,14 +6,7 @@ from sklearn.tree import DecisionTreeClassifier
6
  from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier, GradientBoostingClassifier
7
  import joblib
8
  import pickle
9
- def load_image(image_path):
10
- """
11
- Load image from file path and convert to numpy array
12
- """
13
- with Image.open(image_path).convert('L') as img:
14
- img = img.resize((28,28))
15
- img = np.array(img)
16
- return img
17
 
18
  def fashion_MNIST_prediction(test_image, model='KNN'):
19
  test_image_flatten = test_image.reshape((-1, 28*28))
@@ -59,14 +52,7 @@ def fashion_MNIST_prediction(test_image, model='KNN'):
59
 
60
  else:
61
  return "Invalid Model Selection"
62
- ###
63
- def predict(image_path, model):
64
- test_image = load_image(image_path)
65
- label, prediction = fashion_MNIST_prediction(test_image, model)
66
- return label, prediction
67
-
68
- image_paths = ['Ankle boot.jpg', 'bag.jpg', 'dress.jpg', 't-shirt.jpg']
69
- ###
70
  input_image = gr.inputs.Image(shape=(28, 28), image_mode='L')
71
  input_model = gr.inputs.Dropdown(['KNN', 'DecisionTreeClassifier', 'RandomForestClassifier', 'AdaBoostClassifier', 'GradientBoostingClassifier'])
72
 
 
6
  from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier, GradientBoostingClassifier
7
  import joblib
8
  import pickle
9
+
 
 
 
 
 
 
 
10
 
11
  def fashion_MNIST_prediction(test_image, model='KNN'):
12
  test_image_flatten = test_image.reshape((-1, 28*28))
 
52
 
53
  else:
54
  return "Invalid Model Selection"
55
+
 
 
 
 
 
 
 
56
  input_image = gr.inputs.Image(shape=(28, 28), image_mode='L')
57
  input_model = gr.inputs.Dropdown(['KNN', 'DecisionTreeClassifier', 'RandomForestClassifier', 'AdaBoostClassifier', 'GradientBoostingClassifier'])
58