let's deploy to huggingface spaces
Browse files- 01_tomato.pkl +3 -0
- app.py +12 -0
- requirements.txt +2 -0
01_tomato.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4652c05a640b4697c6b4ded50f5e2e11e951bde43b3d25f0c1b5da2c007fe25f
|
| 3 |
+
size 201640677
|
app.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
+
import skimage
|
| 3 |
+
import gradio as gr
|
| 4 |
+
learn = load_learner('01_tomato.pkl')
|
| 5 |
+
labels = learn_inf.dls.vocab
|
| 6 |
+
def predict(img):
|
| 7 |
+
img = PILImage.create(img)
|
| 8 |
+
pred,pred_idx,probs = learn_inf.predict(img)
|
| 9 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 10 |
+
|
| 11 |
+
title = "Tomato Disease Diagnosis"
|
| 12 |
+
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(256,256)),title = title, outputs=gr.outputs.Label(num_top_classes=1)).launch(share=True)
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastai
|
| 2 |
+
scikit-image
|