VenkataSaiNeha commited on
Commit
9c5e107
1 Parent(s): afc8266

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +28 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from gradio import Interface, Image, Label
3
+ import tensorflow as tf
4
+ # Load your TensorFlow model
5
+ model = tf.keras.models.load_model("bird_species_classification_model.h5")
6
+
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
14
+ img = tf.image.resize(image, (224, 224))
15
+ img = tf.expand_dims(img, 0) # Add batch dimension
16
+ # Make prediction
17
+ prediction = model.predict(img)
18
+ predicted_class = class_names[prediction.argmax()]
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()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ tensorflow
2
+ gradio