Spaces:
Runtime error
Runtime error
Upload 6 files
Browse files- .gitattributes +3 -0
- app.py +25 -25
- glass.png +3 -0
- plastic copy.jpg +3 -0
- plastic.jpg +3 -0
- requirements.txt +2 -0
- trash_model(1).pkl +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,6 @@ saved_model/**/* 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
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 36 |
+
glass.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
plastic[[:space:]]copy.jpg filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
plastic.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
|
@@ -1,25 +1,25 @@
|
|
| 1 |
-
from fastai.vision.all import *
|
| 2 |
-
import gradio as gr
|
| 3 |
-
|
| 4 |
-
# Load the exported model
|
| 5 |
-
learn = load_learner('trash_model(1s).pkl')
|
| 6 |
-
|
| 7 |
-
# Define labels (make sure they match your model's training labels)
|
| 8 |
-
labels = learn.dls.vocab
|
| 9 |
-
|
| 10 |
-
# Define prediction function
|
| 11 |
-
def classify_trash(img):
|
| 12 |
-
pred_class, pred_idx, probs = learn.predict(img)
|
| 13 |
-
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 14 |
-
|
| 15 |
-
# Gradio Interface
|
| 16 |
-
interface = gr.Interface(
|
| 17 |
-
fn=classify_trash,
|
| 18 |
-
inputs=gr.Image(type="pil"),
|
| 19 |
-
outputs=gr.Label(num_top_classes=5),
|
| 20 |
-
title="Trash Classifier",
|
| 21 |
-
description="Upload a trash image to classify it into one of 5 categories."
|
| 22 |
-
)
|
| 23 |
-
|
| 24 |
-
# Launch app
|
| 25 |
-
interface.launch()
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
# Load the exported model
|
| 5 |
+
learn = load_learner('trash_model(1s).pkl')
|
| 6 |
+
|
| 7 |
+
# Define labels (make sure they match your model's training labels)
|
| 8 |
+
labels = learn.dls.vocab
|
| 9 |
+
|
| 10 |
+
# Define prediction function
|
| 11 |
+
def classify_trash(img):
|
| 12 |
+
pred_class, pred_idx, probs = learn.predict(img)
|
| 13 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 14 |
+
|
| 15 |
+
# Gradio Interface
|
| 16 |
+
interface = gr.Interface(
|
| 17 |
+
fn=classify_trash,
|
| 18 |
+
inputs=gr.Image(type="pil"),
|
| 19 |
+
outputs=gr.Label(num_top_classes=5),
|
| 20 |
+
title="Trash Classifier",
|
| 21 |
+
description="Upload a trash image to classify it into one of 5 categories."
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
# Launch app
|
| 25 |
+
interface.launch()
|
glass.png
ADDED
|
Git LFS Details
|
plastic copy.jpg
ADDED
|
Git LFS Details
|
plastic.jpg
ADDED
|
Git LFS Details
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastai
|
| 2 |
+
gradio
|
trash_model(1).pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7c79e9f811d1267483d240511221d32b603b27a5897c183d2e1f5273e9c39ea4
|
| 3 |
+
size 114704730
|