Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- README.md +7 -13
- app.py +20 -0
- requirements.txt +3 -0
README.md
CHANGED
@@ -1,13 +1,7 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
license: mit
|
11 |
-
---
|
12 |
-
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
+
# 🐱 Cat Breed Detector
|
2 |
+
|
3 |
+
This app uses a Hugging Face model to detect cat breeds from images.
|
4 |
+
|
5 |
+
Model: [dima806/cat_breed_image_detection](https://huggingface.co/dima806/cat_breed_image_detection)
|
6 |
+
|
7 |
+
Built with 🤗 Transformers and Gradio.
|
|
|
|
|
|
|
|
|
|
|
|
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load your Hugging Face model
|
5 |
+
classifier = pipeline("image-classification", model="dima806/cat_breed_image_detection")
|
6 |
+
|
7 |
+
# Function to predict from uploaded image
|
8 |
+
def predict(image):
|
9 |
+
result = classifier(image)
|
10 |
+
top_result = result[0]
|
11 |
+
return f"{top_result['label']} ({round(top_result['score'] * 100, 2)}%)"
|
12 |
+
|
13 |
+
# Create a Gradio interface
|
14 |
+
gr.Interface(
|
15 |
+
fn=predict,
|
16 |
+
inputs=gr.Image(type="pil"),
|
17 |
+
outputs="text",
|
18 |
+
title="Cat Breed Detection",
|
19 |
+
description="Upload a cat image and see the predicted breed!"
|
20 |
+
).launch()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|
3 |
+
gradio
|