Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
|
2 |
-
import
|
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 =
|
22 |
-
label =
|
23 |
|
24 |
# Create interface
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
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()
|