vikenkd commited on
Commit
4856f1f
·
1 Parent(s): c3d09d7

[feat]: upload files

Browse files
README.md CHANGED
@@ -1,27 +1,10 @@
1
- ## Image classification - Cat & Dog Classification
2
-
3
- ### Prerequistiion Requirements:
4
- - Training Processing:
5
- - Datasets Zip file to be saved in datasets folder.
6
- - Dependencies Installation:
7
- - Create an virtual environment with conda
8
- - conda `create -p dc_env python=3.9 -y`
9
- - Activate created env: `conda activate dc_env/`
10
- - Using `pip install -r requirements.txt`
11
- - Other Requirements:
12
- - GPU (E.g: NVIDIA RTX 3050,...)
13
- - Python version >= 3.9
14
-
15
- ## How to run this project:
16
- ### Training the model:
17
- - Utilizing `python src/train.py`
18
-
19
- ### Run Deployment on your local:
20
- - Utilizing `python deployment/gradio/main.py` \
21
- Or
22
- - On HuggingFace Server, you can access at: ``
23
-
24
-
25
-
26
-
27
-
 
1
+ ---
2
+ title: Image Classification - Cat & Dog Classification
3
+ emoji: 🐶🐱
4
+ colorFrom: indigo
5
+ colorTo: blue
6
+ sdk: gradio
7
+ sdk_version: "4.44.0"
8
+ app_file: deployment/gradio/app.py
9
+ pinned: false
10
+ ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
deployment/gradio/__init__.py ADDED
File without changes
deployment/gradio/app.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from src.infer import inference_pipeline
3
+
4
+ # model_path = "checkpoints/ckpt_23_10_2025/best_cat_dog_classifier_model_20251019_122336.pth"
5
+
6
+
7
+ def classify_image(
8
+ image_path: str
9
+ ) -> str:
10
+ """
11
+ Classify the input image as cat or dog.
12
+ """
13
+ if image_path is None:
14
+ return "Please upload an image."
15
+ try:
16
+ prediction = inference_pipeline(
17
+ image_path=image_path,
18
+ model_path=model_path,
19
+ hf=True
20
+ )
21
+ return f"Prediction: {prediction.capitalize()}"
22
+ except Exception as e:
23
+ return f"Error: {str(e)}"
24
+
25
+ with gr.Blocks() as demo:
26
+ gr.Markdown("# 🐶🐱 Cat vs Dog Classifier")
27
+
28
+ with gr.Row():
29
+ with gr.Column():
30
+ image_input = gr.Image(
31
+ type="filepath",
32
+ label="Input"
33
+ )
34
+ classify_button = gr.Button("🔍 Classify")
35
+ with gr.Column():
36
+ output_text = gr.Textbox(label="🧠 Prediction", placeholder="Result will appear here")
37
+
38
+ classify_button.click(fn=classify_image, inputs=[image_input], outputs=[output_text])
39
+
40
+ demo.launch(debug=True)
41
+