Spaces:
Build error
Build error
added all files
Browse files- app.py +17 -0
- export.pkl +3 -0
- mango.jpg +0 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from fastai.vision.all import *
|
| 4 |
+
import skimage
|
| 5 |
+
|
| 6 |
+
learn = load_learner('export.pkl')
|
| 7 |
+
|
| 8 |
+
labels = learn.dls.vocab
|
| 9 |
+
|
| 10 |
+
def predict(img):
|
| 11 |
+
img = PILImage.create(img)
|
| 12 |
+
pred,pred_idx,probs = learn.predict(img)
|
| 13 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 14 |
+
|
| 15 |
+
title = "Fruit Classifier"
|
| 16 |
+
|
| 17 |
+
|
export.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f626a614aa590946b5b2bace5942416b8f56b3c9ee24945a8ae7e91e559f4004
|
| 3 |
+
size 46979294
|
mango.jpg
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastai
|
| 2 |
+
scikit-image
|