Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ model_path = "Cat_transfer_learning_MobileNetV2.keras"
|
|
| 7 |
model = tf.keras.models.load_model(model_path)
|
| 8 |
|
| 9 |
# Define the core prediction function
|
| 10 |
-
def
|
| 11 |
# Preprocess image
|
| 12 |
print(type(image))
|
| 13 |
image = Image.fromarray(image.astype('uint8')) # Convert numpy array to PIL image
|
|
@@ -36,7 +36,7 @@ def predict_dog(image):
|
|
| 36 |
# Create the Gradio interface
|
| 37 |
input_image = gr.Image()
|
| 38 |
iface = gr.Interface(
|
| 39 |
-
fn=
|
| 40 |
inputs=input_image,
|
| 41 |
outputs=gr.Label(),
|
| 42 |
examples=["images/americanshorthair_1.jpg", "images/americanshorthair_2.jpg", "images/americanshorthair_3.jpg", "images/bengal_1.jpg", "images/bengal_2.jpeg", "images/bengal_3.jpg", "images/mainecoon_1.jpg", "images/mainecoon_2.jpeg", "images/mainecoon_3.jpg", "images/ragdoll_1.jpg", "images/ragdoll_2.jpg", "images/ragdoll_3.jpeg", "images/scottishfold_1.jpeg", "images/scottishfold_2.jpg", "images/scottishfold_3.jpg", "images/sphinx_1.jpg", "images/sphinx_2.jpg", "images/sphinx_3.jpg"],
|
|
|
|
| 7 |
model = tf.keras.models.load_model(model_path)
|
| 8 |
|
| 9 |
# Define the core prediction function
|
| 10 |
+
def predict_cat(image):
|
| 11 |
# Preprocess image
|
| 12 |
print(type(image))
|
| 13 |
image = Image.fromarray(image.astype('uint8')) # Convert numpy array to PIL image
|
|
|
|
| 36 |
# Create the Gradio interface
|
| 37 |
input_image = gr.Image()
|
| 38 |
iface = gr.Interface(
|
| 39 |
+
fn=predict_cat,
|
| 40 |
inputs=input_image,
|
| 41 |
outputs=gr.Label(),
|
| 42 |
examples=["images/americanshorthair_1.jpg", "images/americanshorthair_2.jpg", "images/americanshorthair_3.jpg", "images/bengal_1.jpg", "images/bengal_2.jpeg", "images/bengal_3.jpg", "images/mainecoon_1.jpg", "images/mainecoon_2.jpeg", "images/mainecoon_3.jpg", "images/ragdoll_1.jpg", "images/ragdoll_2.jpg", "images/ragdoll_3.jpeg", "images/scottishfold_1.jpeg", "images/scottishfold_2.jpg", "images/scottishfold_3.jpg", "images/sphinx_1.jpg", "images/sphinx_2.jpg", "images/sphinx_3.jpg"],
|