srinuksv commited on
Commit
261555d
·
verified ·
1 Parent(s): 43f59b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -1,5 +1,5 @@
1
- import gradio as gr
2
- import tensorflow as tf
3
 
4
  # Load your TensorFlow model
5
  model = tf.keras.models.load_model("bird_species_classification_model.h5")
@@ -7,6 +7,7 @@ model = tf.keras.models.load_model("bird_species_classification_model.h5")
7
  # Define your class names if needed
8
  class_names = ['ABBOTTS BABBLER', 'ABBOTTS BOOBY', 'ABYSSINIAN GROUND HORNBILL', 'AFRICAN CROWNED CRANE', 'AFRICAN EMERALD CUCKOO', 'AFRICAN FIREFINCH', 'AFRICAN OYSTER CATCHER', 'AFRICAN PIED HORNBILL', 'AFRICAN PYGMY GOOSE', 'ALBATROSS', 'ALBERTS TOWHEE', 'ALEXANDRINE PARAKEET', 'ALPINE CHOUGH', 'ALTAMIRA YELLOWTHROAT', 'AMERICAN AVOCET', 'AMERICAN BITTERN', 'AMERICAN COOT', 'AMERICAN FLAMINGO', 'AMERICAN GOLDFINCH', 'AMERICAN KESTREL']
9
 
 
10
  # Function to make predictions
11
  def classify_image(image):
12
  # Preprocess the image
@@ -18,10 +19,10 @@ def classify_image(image):
18
  return predicted_class
19
 
20
  # Gradio interface
21
- image = gr.inputs.Image() # Remove the `shape` argument
22
- label = gr.outputs.Label()
23
 
24
  # Create interface
25
- gr.Interface(classify_image, image, label,
26
- title="Bird Species Classification",
27
- description="Upload an image of a bird to classify its species.").launch()
 
1
+
2
+ from gradio import Interface, Image, Label
3
 
4
  # Load your TensorFlow model
5
  model = tf.keras.models.load_model("bird_species_classification_model.h5")
 
7
  # Define your class names if needed
8
  class_names = ['ABBOTTS BABBLER', 'ABBOTTS BOOBY', 'ABYSSINIAN GROUND HORNBILL', 'AFRICAN CROWNED CRANE', 'AFRICAN EMERALD CUCKOO', 'AFRICAN FIREFINCH', 'AFRICAN OYSTER CATCHER', 'AFRICAN PIED HORNBILL', 'AFRICAN PYGMY GOOSE', 'ALBATROSS', 'ALBERTS TOWHEE', 'ALEXANDRINE PARAKEET', 'ALPINE CHOUGH', 'ALTAMIRA YELLOWTHROAT', 'AMERICAN AVOCET', 'AMERICAN BITTERN', 'AMERICAN COOT', 'AMERICAN FLAMINGO', 'AMERICAN GOLDFINCH', 'AMERICAN KESTREL']
9
 
10
+
11
  # Function to make predictions
12
  def classify_image(image):
13
  # Preprocess the image
 
19
  return predicted_class
20
 
21
  # Gradio interface
22
+ image = Image() # Remove the `shape` argument
23
+ label = Label()
24
 
25
  # Create interface
26
+ interface = Interface(classify_image, image, label,
27
+ title="Bird Species Classification",
28
+ description="Upload an image of a bird to classify its species.").launch()