Update app.py
Browse files
app.py
CHANGED
@@ -31,14 +31,14 @@ def predict_image(image):
|
|
31 |
except Exception as e:
|
32 |
return [("Error", str(e))]
|
33 |
|
34 |
-
# Create the Gradio interface
|
35 |
interface = gr.Interface(
|
36 |
fn=predict_image,
|
37 |
inputs=gr.Image(type="pil"), # Accepts an image input
|
38 |
-
outputs=gr.
|
39 |
title="Image Classifier",
|
40 |
description="Upload an image, and the model will predict what's in the image with higher accuracy.",
|
41 |
-
|
42 |
)
|
43 |
|
44 |
# Launch the Gradio app
|
|
|
31 |
except Exception as e:
|
32 |
return [("Error", str(e))]
|
33 |
|
34 |
+
# Create the Gradio interface with gr.Dataframe for displaying predictions
|
35 |
interface = gr.Interface(
|
36 |
fn=predict_image,
|
37 |
inputs=gr.Image(type="pil"), # Accepts an image input
|
38 |
+
outputs=gr.Dataframe(headers=["Label", "Confidence"], type="array"), # Shows top 5 predictions as a table
|
39 |
title="Image Classifier",
|
40 |
description="Upload an image, and the model will predict what's in the image with higher accuracy.",
|
41 |
+
examples=["dog.jpg", "cat.jpg", "building.jpg", "tree.jpg"], # Example images for testing
|
42 |
)
|
43 |
|
44 |
# Launch the Gradio app
|