valiyevfagan commited on
Commit
a2383c3
·
verified ·
1 Parent(s): c803f21

Upload 6 files

Browse files
Files changed (7) hide show
  1. .gitattributes +3 -0
  2. app.py +25 -25
  3. glass.png +3 -0
  4. plastic copy.jpg +3 -0
  5. plastic.jpg +3 -0
  6. requirements.txt +2 -0
  7. 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

  • SHA256: 472028b9c08de80c930fb5f236c8f2ed7aaeaa200dae2913f3e8441f4b3becc7
  • Pointer size: 131 Bytes
  • Size of remote file: 514 kB
plastic copy.jpg ADDED

Git LFS Details

  • SHA256: b4f6fff8196703370b75c2d60b88a87d507ff70ada518f29e70e08109bf76961
  • Pointer size: 131 Bytes
  • Size of remote file: 148 kB
plastic.jpg ADDED

Git LFS Details

  • SHA256: b4f6fff8196703370b75c2d60b88a87d507ff70ada518f29e70e08109bf76961
  • Pointer size: 131 Bytes
  • Size of remote file: 148 kB
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