Spaces:
Runtime error
Runtime error
jonathanIckovich
commited on
Commit
·
d0acbbb
1
Parent(s):
a7b8d2d
built in requirments
Browse files- app.py +4 -4
- requirements.txt +2 -0
app.py
CHANGED
@@ -4,10 +4,10 @@ from fastai.vision.all import *
|
|
4 |
learn = load_learner('ImageDifferentiator.pkl')
|
5 |
labels = learn.dls.vocab
|
6 |
def predict(img):
|
|
|
7 |
img = PILImage.create(img)
|
8 |
-
pred,pred_idx,probs = learn.predict(img)
|
9 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
10 |
|
11 |
-
|
12 |
-
iface
|
13 |
-
iface.launch()
|
|
|
4 |
learn = load_learner('ImageDifferentiator.pkl')
|
5 |
labels = learn.dls.vocab
|
6 |
def predict(img):
|
7 |
+
|
8 |
img = PILImage.create(img)
|
9 |
+
pred, pred_idx, probs = learn.predict(img)
|
10 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
11 |
|
12 |
+
iface = gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3))
|
13 |
+
iface.launch(share=True)
|
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
gradio
|