kiki7555 commited on
Commit
3d9abc6
1 Parent(s): 41a3ac3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -4,14 +4,14 @@ from PIL import Image
4
  import numpy as np
5
 
6
  # Load the dog breed classifier model
7
- model_path = "dog_breed_classifier_trained.keras"
8
  model = tf.keras.models.load_model(model_path)
9
  labels = ['Beagle', 'French Bulldog', 'German Shepherd', 'Golden Retriever', 'Labrador Retriever']
10
 
11
  # Define function for dog breed classification with data augmentation
12
  def preprocess_image(image):
13
  image = Image.fromarray(image.astype('uint8'), 'RGB')
14
- image = image.resize((128, 128))
15
  image = np.array(image)
16
  image = image / 255.0 # Normalization of pixel values
17
  return image
@@ -28,7 +28,9 @@ def predict_dog_breed(image):
28
  # Create Gradio interface
29
  input_image = gr.Image()
30
  output_text = gr.Textbox(label="Dog Breed")
31
- interface = gr.Interface(fn=predict_dog_breed, inputs=input_image, outputs=output_text, description="A dog breed classifier using transfer learning and fine-tuning with EfficientNetB0.", theme="default")
 
 
32
 
33
  if __name__ == "__main__":
34
  interface.launch()
 
4
  import numpy as np
5
 
6
  # Load the dog breed classifier model
7
+ model_path = "best_model.keras"
8
  model = tf.keras.models.load_model(model_path)
9
  labels = ['Beagle', 'French Bulldog', 'German Shepherd', 'Golden Retriever', 'Labrador Retriever']
10
 
11
  # Define function for dog breed classification with data augmentation
12
  def preprocess_image(image):
13
  image = Image.fromarray(image.astype('uint8'), 'RGB')
14
+ image = image.resize((150, 150))
15
  image = np.array(image)
16
  image = image / 255.0 # Normalization of pixel values
17
  return image
 
28
  # Create Gradio interface
29
  input_image = gr.Image()
30
  output_text = gr.Textbox(label="Dog Breed")
31
+ interface = gr.Interface(fn=predict_dog_breed, inputs=input_image, outputs=output_text,
32
+ description="A dog breed classifier using a custom CNN model with data augmentation and regularization techniques.",
33
+ theme="default")
34
 
35
  if __name__ == "__main__":
36
  interface.launch()