Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,4 +28,17 @@ def predict_animal(image):
|
|
| 28 |
return {class_names[i]: float(probs[i]) for i in range(len(class_names))}
|
| 29 |
|
| 30 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 31 |
-
gr.Markdown("# 🐾 Animal Type
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
return {class_names[i]: float(probs[i]) for i in range(len(class_names))}
|
| 29 |
|
| 30 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 31 |
+
gr.Markdown("# 🐾 Animal Type Classifier")
|
| 32 |
+
gr.Markdown("Upload an image of an animal below and get predictions for butterflies, chickens, elephants, horses, spiders, or squirrels.")
|
| 33 |
+
|
| 34 |
+
with gr.Row():
|
| 35 |
+
img_input = gr.Image(type="pil", label="Upload Animal Image")
|
| 36 |
+
label_output = gr.Label(num_top_classes=6, label="Prediction Scores")
|
| 37 |
+
|
| 38 |
+
predict_button = gr.Button("Classify Animal")
|
| 39 |
+
predict_button.click(fn=predict_animal, inputs=img_input, outputs=label_output)
|
| 40 |
+
|
| 41 |
+
gr.Markdown("Developed with Ultralytics YOLO and Gradio framework.")
|
| 42 |
+
|
| 43 |
+
if __name__ == "__main__":
|
| 44 |
+
demo.launch()
|