Spaces:
Sleeping
Sleeping
dev-encourt
commited on
Commit
•
6ea16ed
1
Parent(s):
6b8fb35
initial commit, added app.py and requirements.txt
Browse files- app.py +16 -0
- model.pkl +3 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import skimage
|
3 |
+
from fastai.vision.all import *
|
4 |
+
|
5 |
+
path = Path()
|
6 |
+
learn = load_learner('model.pkl')
|
7 |
+
|
8 |
+
labels = learn.dls.vocab # read labels from Data Loader
|
9 |
+
def predict(img):
|
10 |
+
pred,pred_idx,probs = learn.predict(img) # use passed image for prediction
|
11 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))} # return all results
|
12 |
+
|
13 |
+
gradio_interface = gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3))
|
14 |
+
gradio_interface.launch()
|
15 |
+
|
16 |
+
#mean comment
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c4a7f061a8780501bcfd7000b5cb3a17d5be6da4799acdeeb7166695b3c870d4
|
3 |
+
size 46950105
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|