membrfab commited on
Commit
f0d4b98
1 Parent(s): 613d735

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -3,10 +3,10 @@ import tensorflow as tf
3
  import numpy as np
4
  from PIL import Image
5
 
6
- # Load your custom classification models
7
- transfer_learning_model = tf.keras.models.load_model('model_mobilenet.keras')
8
 
9
- # Class names, should match your dataset
10
  class_names = ['butterfly', 'cat', 'elephant', 'horse', 'squirrel']
11
 
12
  def classify_image(image, model):
@@ -15,7 +15,7 @@ def classify_image(image, model):
15
  image = Image.fromarray(image.astype('uint8'), 'RGB')
16
 
17
  # Resize the image using np.resize
18
- image = np.resize(image, (224, 224, 3)) # Add the channel dimension
19
 
20
  image = image / 255.0 # Normalize the image
21
  image = np.expand_dims(image, axis=0) # Add batch dimension
@@ -40,7 +40,7 @@ transfer_learning_interface = gr.Interface(
40
  inputs=image_input,
41
  outputs=label,
42
  title='Animal Classifier',
43
- description='Upload an image of an animal, and the classifier will tell you which animal it is, along with the confidence level of the prediction.'
44
  )
45
 
46
  transfer_learning_interface.launch()
 
3
  import numpy as np
4
  from PIL import Image
5
 
6
+ # Load the custom classification models
7
+ transfer_learning_model = tf.keras.models.load_model('model_vgg16.keras')
8
 
9
+ # Class names
10
  class_names = ['butterfly', 'cat', 'elephant', 'horse', 'squirrel']
11
 
12
  def classify_image(image, model):
 
15
  image = Image.fromarray(image.astype('uint8'), 'RGB')
16
 
17
  # Resize the image using np.resize
18
+ image = np.resize(image, (300, 300, 3)) # Add the channel dimension
19
 
20
  image = image / 255.0 # Normalize the image
21
  image = np.expand_dims(image, axis=0) # Add batch dimension
 
40
  inputs=image_input,
41
  outputs=label,
42
  title='Animal Classifier',
43
+ description='Upload an image of a butterfly, a cat, an elephant, a horse or a squirrel, and the classifier will tell you which animal it is, along with the confidence level of the prediction.'
44
  )
45
 
46
  transfer_learning_interface.launch()