Spaces:
Runtime error
Runtime error
Upload 6 files
Browse files- .gitattributes +2 -0
- app.py +28 -0
- banana_with_brown_spots.jpg +0 -0
- black_banana.jpg +0 -0
- green_banana.jpg +3 -0
- requirements.txt +2 -0
- yellow_banana.jpg +3 -0
.gitattributes
CHANGED
@@ -35,3 +35,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
fastai_banana_classifier/green_banana.jpg filter=lfs diff=lfs merge=lfs -text
|
37 |
fastai_banana_classifier/yellow_banana.jpg filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
fastai_banana_classifier/green_banana.jpg filter=lfs diff=lfs merge=lfs -text
|
37 |
fastai_banana_classifier/yellow_banana.jpg filter=lfs diff=lfs merge=lfs -text
|
38 |
+
green_banana.jpg filter=lfs diff=lfs merge=lfs -text
|
39 |
+
yellow_banana.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
|
4 |
+
learn = load_learner('model.pkl')
|
5 |
+
labels = ['brown_spots', 'green', 'spoiled', 'yellow']
|
6 |
+
|
7 |
+
|
8 |
+
def predict(img):
|
9 |
+
img = PILImage.create(img)
|
10 |
+
pred,pred_idx,probs = learn.predict(img)
|
11 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
12 |
+
|
13 |
+
title = "Banana Quality Classifier"
|
14 |
+
description = "A banana classifier that can classify bananas into 4 categories based on their quality"
|
15 |
+
examples = ['yellow_banana.jpg', 'green_banana.jpg', 'banana_with_brown_spots.jpg', 'black_banana.jpg']
|
16 |
+
interpretation='default'
|
17 |
+
enable_queue=True
|
18 |
+
|
19 |
+
gr.Interface(
|
20 |
+
fn=predict,
|
21 |
+
inputs=gr.inputs.Image(shape=(512, 512)),
|
22 |
+
outputs=gr.outputs.Label(num_top_classes=3),
|
23 |
+
title=title,
|
24 |
+
description=description,
|
25 |
+
examples=examples,
|
26 |
+
interpretation=interpretation,
|
27 |
+
enable_queue=enable_queue
|
28 |
+
).launch()
|
banana_with_brown_spots.jpg
ADDED
![]() |
black_banana.jpg
ADDED
![]() |
green_banana.jpg
ADDED
![]() |
Git LFS Details
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|
yellow_banana.jpg
ADDED
![]() |
Git LFS Details
|