Spaces:
Running
on
Zero
Running
on
Zero
feat: add confidence score feature to model predictions
Browse files- .gitattributes +35 -0
- README.md +25 -76
- app.py +2 -2
- requirements.txt +1 -1
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,76 +1,25 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
-----
|
| 27 |
-
|
| 28 |
-
## π Kaggle Notebook
|
| 29 |
-
|
| 30 |
-
Explore the model fine-tuning process and the underlying code in our detailed Kaggle Notebook.
|
| 31 |
-
|
| 32 |
-
**β‘οΈ [Gemma3n Challenge Notebook](https://www.kaggle.com/code/yichuanhuang/gemma3n-challenge)**
|
| 33 |
-
|
| 34 |
-
-----
|
| 35 |
-
|
| 36 |
-
## π οΈ Getting Started
|
| 37 |
-
|
| 38 |
-
### Prerequisites
|
| 39 |
-
|
| 40 |
-
* Python 3.9+
|
| 41 |
-
* Pip
|
| 42 |
-
* Cuda (optional)
|
| 43 |
-
|
| 44 |
-
### Installation
|
| 45 |
-
|
| 46 |
-
1. Clone the repository:
|
| 47 |
-
```bash
|
| 48 |
-
git clone https://github.com/yichuan-huang/gemma3n-challenge
|
| 49 |
-
```
|
| 50 |
-
2. Navigate to the project directory:
|
| 51 |
-
```bash
|
| 52 |
-
cd gemma3n-challenge
|
| 53 |
-
```
|
| 54 |
-
3. Install the required dependencies:
|
| 55 |
-
```bash
|
| 56 |
-
pip install -r requirements.txt
|
| 57 |
-
```
|
| 58 |
-
|
| 59 |
-
### Running the application
|
| 60 |
-
|
| 61 |
-
To start the application, run the following command:
|
| 62 |
-
|
| 63 |
-
```bash
|
| 64 |
-
python app.py
|
| 65 |
-
```
|
| 66 |
-
|
| 67 |
-
This will launch a Gradio web server. You can access the application by opening the provided URL in your web browser.
|
| 68 |
-
|
| 69 |
-
## π Project Structure
|
| 70 |
-
|
| 71 |
-
* `app.py`: The main application file, containing the Gradio interface and the classification logic.
|
| 72 |
-
* `classifier.py`: Handles the image classification using the pre-trained model.
|
| 73 |
-
* `config.py`: Contains configuration settings for the application, such as the model name and labels.
|
| 74 |
-
* `knowledge_base.py`: A simple knowledge base containing disposal information for different waste materials.
|
| 75 |
-
* `requirements.txt`: A list of the Python dependencies required to run the application.
|
| 76 |
-
* `test_images/`: A directory containing sample images for testing the application.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Gemma3n Challenge
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 5.37.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Garbage Classification System
|
| 14 |
+
|
| 15 |
+
A Gradio app for classifying garbage into 4 categories using Gemma-3n model.
|
| 16 |
+
|
| 17 |
+
## Usage
|
| 18 |
+
1. Upload an image.
|
| 19 |
+
2. Click "Classify Garbage" or wait for auto-classification.
|
| 20 |
+
|
| 21 |
+
## Categories
|
| 22 |
+
- Recyclable Waste
|
| 23 |
+
- Food/Kitchen Waste
|
| 24 |
+
- Hazardous Waste
|
| 25 |
+
- Other Waste
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -29,7 +29,7 @@ def classify_garbage_impl(image):
|
|
| 29 |
Actual classification implementation
|
| 30 |
"""
|
| 31 |
if image is None:
|
| 32 |
-
return "Please upload an image", "No image provided"
|
| 33 |
|
| 34 |
try:
|
| 35 |
classification, full_response, confidence_score = classifier.classify_image(image)
|
|
@@ -117,4 +117,4 @@ with gr.Blocks(title="Garbage Classification System") as demo:
|
|
| 117 |
)
|
| 118 |
|
| 119 |
if __name__ == "__main__":
|
| 120 |
-
demo.launch()
|
|
|
|
| 29 |
Actual classification implementation
|
| 30 |
"""
|
| 31 |
if image is None:
|
| 32 |
+
return "Please upload an image", "No image provided"
|
| 33 |
|
| 34 |
try:
|
| 35 |
classification, full_response, confidence_score = classifier.classify_image(image)
|
|
|
|
| 117 |
)
|
| 118 |
|
| 119 |
if __name__ == "__main__":
|
| 120 |
+
demo.launch()
|
requirements.txt
CHANGED
|
@@ -5,4 +5,4 @@ torchvision
|
|
| 5 |
transformers >= 4.53
|
| 6 |
accelerate
|
| 7 |
timm
|
| 8 |
-
gradio
|
|
|
|
| 5 |
transformers >= 4.53
|
| 6 |
accelerate
|
| 7 |
timm
|
| 8 |
+
gradio
|