Aum123 commited on
Commit
848b1a3
·
verified ·
1 Parent(s): 80d165c

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -13
  2. app.py +20 -0
  3. requirements.txt +3 -0
README.md CHANGED
@@ -1,13 +1,7 @@
1
- ---
2
- title: Cat Breed Detector
3
- emoji: 📈
4
- colorFrom: green
5
- colorTo: indigo
6
- sdk: gradio
7
- sdk_version: 5.23.1
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